home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / technote / tn283.sit / TN.283.A_UX System Calls
Unknown  |  1991-05-06  |  56.8 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was not able to be converted.
This format is not currently supported by dexvert.

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert Jesper Olsen Module (music/jesperOlsen) magic Supported
1% dexvert TTComp Archive (archive/ttcomp) fallback Supported
100% file TTComp archive data, binary, 4K dictionary default (weak)
99% file data default
100% TrID TTComp archive compressed (bin-4K) default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 06 02 3a 00 01 00 04 | 00 00 00 ff ff ff ff fc |...:....|........|
|00000010| 00 01 00 00 e3 10 00 40 | 00 40 00 00 de 32 00 08 |.......@|.@...2..|
|00000020| 00 08 00 00 00 00 00 00 | 00 03 00 00 00 48 00 48 |........|.....H.H|
|00000030| 00 00 00 00 02 da 02 28 | ff e1 ff e2 02 f9 02 46 |.......(|.......F|
|00000040| 03 47 05 28 03 fc 00 02 | 00 00 00 48 00 48 00 00 |.G.(....|...H.H..|
|00000050| 00 00 02 da 02 28 00 01 | 00 00 00 64 00 00 00 01 |.....(..|...d....|
|00000060| 00 01 01 01 00 00 00 01 | 27 0f 00 01 00 01 00 00 |........|'.......|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 00 0a 00 19 01 90 |........|........|
|00000080| 00 00 00 00 00 40 00 00 | 00 00 00 00 00 00 00 01 |.....@..|........|
|00000090| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000a0| 00 01 00 00 00 01 00 00 | 00 00 00 01 00 00 b1 d2 |........|........|
|000000b0| 00 40 00 00 b1 be 00 14 | ff f2 00 1e ff f2 00 ec |.@......|........|
|000000c0| ff f2 01 ba 00 00 00 00 | 00 ff ff ff ff ff 00 01 |........|........|
|000000d0| 00 00 00 01 00 00 00 00 | ff ff 00 00 b2 12 00 10 |........|........|
|000000e0| 00 00 01 46 00 02 ff f2 | 00 1e ff f2 00 ec ff f2 |...F....|........|
|000000f0| 01 ba 00 00 00 00 00 ff | ff ff ff ff 00 01 00 00 |........|........|
|00000100| 00 01 00 00 00 00 00 01 | 00 00 bf 70 23 a0 00 00 |........|...p#...|
|00000110| b2 22 0d 4e ff f2 00 1e | ff f2 00 ec ff f2 01 ba |.".N....|........|
|00000120| 00 00 00 00 ff 00 ff ff | ff ff 00 00 01 e6 03 01 |........|........|
|00000130| 00 00 00 00 00 2d 03 e8 | 00 0d 4d 41 47 49 43 50 |.....-..|..MAGICP|
|00000140| 49 43 11 01 ff 96 00 00 | 00 00 00 00 00 01 0d 00 |IC......|........|
|00000150| 00 06 00 00 0a 00 00 14 | 00 01 0d 5c 00 06 00 00 |........|...\....|
|00000160| 0a 00 00 14 00 39 23 32 | 38 33 3a 20 20 41 2f 55 |.....9#2|83: A/U|
|00000170| 58 20 53 79 73 74 65 6d | 20 43 61 6c 6c 73 20 46 |X System| Calls F|
|00000180| 72 6f 6d 20 4d 61 63 69 | 6e 74 6f 73 68 20 53 6f |rom Maci|ntosh So|
|00000190| 66 74 77 61 72 65 09 23 | 70 20 6f 66 20 31 34 3f |ftware.#|p of 14?|
|000001a0| 00 06 00 00 0a 00 00 14 | 00 00 01 e6 01 0a 00 00 |........|........|
|000001b0| 00 00 00 24 00 48 00 6c | 00 90 00 b4 00 d8 00 fc |...$.H.l|........|
|000001c0| 01 20 01 44 01 68 00 00 | 00 00 00 00 00 00 00 55 |. .D.h..|.......U|
|000001d0| 01 e5 01 39 00 07 00 07 | 00 5c 01 ec 11 01 a0 00 |...9....|.\......|
|000001e0| 82 a0 00 8c a0 00 8c a1 | 00 96 00 06 05 00 00 00 |........|........|
|000001f0| 02 5c a1 00 9a 00 08 00 | 06 00 00 00 51 00 00 a0 |.\......|....Q...|
|00000200| 00 98 01 00 0a 00 07 00 | 07 00 5c 01 ec 2c 00 08 |........|..\..,..|
|00000210| 00 14 05 54 69 6d 65 73 | 03 00 14 0d 00 18 2b 0e |...Times|......+.|
|00000220| 1d 0a 4d 61 63 69 6e 74 | 6f 73 68 0d a0 00 99 a1 |..Macint|osh.....|
|00000230| 00 9a 00 08 ff ee 00 00 | 00 51 00 00 a0 00 98 2a |........|.Q.....*|
|00000240| 18 0f 54 65 63 68 6e 69 | 63 61 6c 20 4e 6f 74 65 |..Techni|cal Note|
|00000250| 73 a0 00 99 a0 00 97 a1 | 00 96 00 06 05 00 00 00 |s.......|........|
|00000260| 02 5c a1 00 9a 00 08 ff | fc 00 00 00 6c 00 00 a0 |.\......|....l...|
|00000270| 00 98 0d 00 12 2b f1 1f | 1b 44 65 76 65 6c 6f 70 |.....+..|.Develop|
|00000280| 65 72 20 54 65 63 68 6e | 69 63 61 6c 20 53 75 70 |er Techn|ical Sup|
|00000290| 70 6f 72 74 a0 00 99 a0 | 00 97 07 00 02 00 02 20 |port....|....... |
|000002a0| 00 3f 00 09 00 3f 01 d9 | a0 00 8d a0 00 8c a1 00 |.?...?..|........|
|000002b0| 96 00 06 05 00 00 00 02 | 5c a1 00 9a 00 08 ff ef |........|\.......|
|000002c0| 00 00 00 1b 00 00 a0 00 | 98 0d 00 30 28 00 37 01 |........|...0(.7.|
|000002d0| b2 01 f0 a0 00 99 a0 00 | 97 a1 00 96 00 06 05 00 |........|........|
|000002e0| 00 00 02 5c a1 00 9a 00 | 08 ff fe 00 00 00 06 00 |...\....|........|
|000002f0| 00 a0 00 98 0d 00 09 29 | 22 01 a8 a0 00 99 a0 00 |.......)|".......|
|00000300| 97 a0 00 8d a0 00 8d a0 | 00 83 ff 79 00 00 00 00 |........|...y....|
|00000310| 00 20 03 e8 00 0d 4d 41 | 47 49 43 50 49 43 11 01 |. ....MA|GICPIC..|
|00000320| ff 96 97 a0 00 8d a0 00 | 8d a0 00 83 ff 79 00 30 |........|.....y.0|
|00000330| 23 32 38 33 3a 09 41 2f | 55 58 20 53 79 73 74 65 |#283:.A/|UX Syste|
|00000340| 6d 20 43 61 6c 6c 73 20 | 46 72 6f 6d 20 4d 61 63 |m Calls |From Mac|
|00000350| 69 6e 74 6f 73 68 20 53 | 6f 66 74 77 61 72 65 0d |intosh S|oftware.|
|00000360| 00 06 00 00 12 01 00 14 | 00 00 01 e6 03 0a 00 00 |........|........|
|00000370| 00 00 00 24 00 48 00 6c | 00 90 00 b4 00 d8 00 fc |...$.H.l|........|
|00000380| 01 20 01 44 01 68 00 00 | 00 00 00 01 0d 00 00 06 |. .D.h..|........|
|00000390| 00 00 0c 00 00 14 00 6f | 52 65 76 69 73 65 64 20 |.......o|Revised |
|000003a0| 62 79 3a 09 41 6e 61 74 | 68 61 6e 20 53 72 69 6e |by:.Anat|han Srin|
|000003b0| 69 76 61 73 61 6e 20 26 | 20 4b 65 6e 74 20 53 61 |ivasan &| Kent Sa|
|000003c0| 6e 64 76 69 6b 20 20 20 | 20 20 20 20 20 20 20 20 |ndvik | |
|000003d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000003e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000003f0| 20 20 20 20 20 20 20 20 | 20 20 4a 61 6e 75 61 72 | | Januar|
|00000400| 79 20 31 39 39 31 0d 05 | 00 06 00 00 0c 00 00 14 |y 1991..|........|
|00000410| 00 12 01 e6 03 02 00 00 | 00 00 00 48 01 d4 00 00 |........|...H....|
|00000420| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000430| 00 00 00 49 57 72 69 74 | 74 65 6e 20 62 79 3a 09 |...IWrit|ten by:.|
|00000440| 52 6f 62 20 4d 2e 20 53 | 6d 69 74 68 2c 20 42 2e |Rob M. S|mith, B.|
|00000450| 20 57 2e 20 48 65 6e 64 | 72 69 63 6b 73 6f 6e 20 | W. Hend|rickson |
|00000460| 26 20 44 61 76 65 20 52 | 61 64 63 6c 69 66 66 65 |& Dave R|adcliffe|
|00000470| 09 41 75 67 75 73 74 20 | 31 39 39 30 0d 68 00 06 |.August |1990.h..|
|00000480| 00 00 0c 00 00 14 00 12 | 01 e6 03 03 00 00 00 00 |........|........|
|00000490| ff b8 00 90 01 d4 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004a0| 00 00 00 00 00 00 00 00 | 00 01 0d 00 00 06 00 00 |........|........|
|000004b0| 0c 00 00 14 00 00 01 e6 | 03 02 00 00 00 00 00 90 |........|........|
|000004c0| 01 b0 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004d0| 00 00 00 00 00 00 00 dd | 54 68 69 73 20 54 65 63 |........|This Tec|
|000004e0| 68 6e 69 63 61 6c 20 4e | 6f 74 65 20 64 69 73 63 |hnical N|ote disc|
|000004f0| 75 73 73 65 73 20 68 6f | 77 20 74 6f 20 6d 61 6b |usses ho|w to mak|
|00000500| 65 20 41 2f 55 58 20 73 | 79 73 74 65 6d 20 63 61 |e A/UX s|ystem ca|
|00000510| 6c 6c 73 20 66 72 6f 6d | 20 61 70 70 6c 69 63 61 |lls from| applica|
|00000520| 74 69 6f 6e 73 20 64 65 | 76 65 6c 6f 70 65 64 20 |tions de|veloped |
|00000530| 69 6e 20 74 68 65 20 4d | 61 63 69 6e 74 6f 73 68 |in the M|acintosh|
|00000540| 20 65 6e 76 69 72 6f 6e | 6d 65 6e 74 2e 20 20 54 | environ|ment. T|
|00000550| 68 69 73 20 69 73 20 75 | 73 65 66 75 6c 20 74 6f |his is u|seful to|
|00000560| 20 61 6e 79 6f 6e 65 20 | 70 6f 72 74 69 6e 67 20 | anyone |porting |
|00000570| 61 6e 20 65 78 69 73 74 | 69 6e 67 20 4d 61 63 69 |an exist|ing Maci|
|00000580| 6e 74 6f 73 68 20 64 72 | 69 76 65 72 20 6f 72 20 |ntosh dr|iver or |
|00000590| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 74 6f 20 77 |applicat|ion to w|
|000005a0| 6f 72 6b 20 6f 6e 20 41 | 2f 55 58 20 61 73 20 77 |ork on A|/UX as w|
|000005b0| 65 6c 6c 2e 0d 00 00 06 | 00 00 0c 00 00 14 00 01 |ell.....|........|
|000005c0| 0d 48 00 06 00 00 0c 00 | 00 14 00 c4 43 68 61 6e |.H......|....Chan|
|000005d0| 67 65 73 20 73 69 6e 63 | 65 20 41 75 67 75 73 74 |ges sinc|e August|
|000005e0| 20 31 39 39 30 3a 20 41 | 64 64 65 64 20 69 6e 66 | 1990: A|dded inf|
|000005f0| 6f 72 6d 61 74 69 6f 6e | 20 61 62 6f 75 74 20 68 |ormation| about h|
|00000600| 6f 77 20 74 6f 20 6d 61 | 6b 65 20 75 73 65 20 6f |ow to ma|ke use o|
|00000610| 66 20 66 6f 72 6b 28 29 | 20 73 79 73 74 65 6d 20 |f fork()| system |
|00000620| 63 61 6c 6c 73 20 75 6e | 64 65 72 20 4d 75 6c 74 |calls un|der Mult|
|00000630| 69 46 69 6e 64 65 72 2c | 20 61 73 20 77 65 6c 6c |iFinder,| as well|
|00000640| 20 61 73 20 68 6f 77 20 | 76 61 72 69 6f 75 73 20 | as how |various |
|00000650| 41 2f 55 58 20 73 79 73 | 74 65 6d 20 63 61 6c 6c |A/UX sys|tem call|
|00000660| 73 20 62 65 68 61 76 65 | 20 75 6e 64 65 72 20 74 |s behave| under t|
|00000670| 68 65 20 4d 75 6c 74 69 | 46 69 6e 64 65 72 20 65 |he Multi|Finder e|
|00000680| 6d 75 6c 61 74 69 6f 6e | 20 6d 6f 64 65 2e 20 0d |mulation| mode. .|
|00000690| 00 18 00 00 0c 01 00 14 | 00 1a 0c 00 00 14 00 47 |........|.......G|
|000006a0| 0c 00 00 16 00 4c 0c 00 | 00 14 00 00 01 e6 03 0a |.....L..|........|
|000006b0| 00 00 00 00 00 24 00 48 | 00 6c 00 90 00 b4 00 d8 |.....$.H|.l......|
|000006c0| 00 fc 01 20 01 44 01 68 | 00 00 00 00 00 01 0d 00 |... .D.h|........|
|000006d0| 00 06 00 00 0c 00 00 14 | 00 01 0d 00 00 06 00 00 |........|........|
|000006e0| 0c 00 00 14 00 01 0d 00 | 00 06 00 00 0c 00 00 14 |........|........|
|000006f0| 00 0d 49 6e 74 72 6f 64 | 75 63 74 69 6f 6e 0d a8 |..Introd|uction..|
|00000700| 00 06 00 00 0e 01 00 14 | 00 01 0d 6b 00 06 00 00 |........|...k....|
|00000710| 0c 00 00 14 01 a3 41 2f | 55 58 20 32 2e 30 20 6e |......A/|UX 2.0 n|
|00000720| 6f 77 20 72 75 6e 73 20 | 61 20 62 72 6f 61 64 20 |ow runs |a broad |
|00000730| 72 61 6e 67 65 20 6f 66 | 20 4d 61 63 69 6e 74 6f |range of| Macinto|
|00000740| 73 68 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 73 2e |sh appli|cations.|
|00000750| 20 20 54 68 65 20 41 2f | 55 58 20 54 6f 6f 6c 62 | The A/|UX Toolb|
|00000760| 6f 78 20 61 6c 6c 6f 77 | 73 20 6d 6f 73 74 20 63 |ox allow|s most c|
|00000770| 6f 64 65 20 64 65 76 65 | 6c 6f 70 65 64 20 66 6f |ode deve|loped fo|
|00000780| 72 20 74 68 65 20 4d 61 | 63 69 6e 74 6f 73 68 20 |r the Ma|cintosh |
|00000790| 74 6f 20 72 75 6e 20 75 | 6e 6d 6f 64 69 66 69 65 |to run u|nmodifie|
|000007a0| 64 20 75 6e 64 65 72 20 | 41 2f 55 58 2e 20 20 4f |d under |A/UX. O|
|000007b0| 6e 65 20 65 78 63 65 70 | 74 69 6f 6e 20 69 73 20 |ne excep|tion is |
|000007c0| 4d 61 63 69 6e 74 6f 73 | 68 20 64 65 76 69 63 65 |Macintos|h device|
|000007d0| 20 64 72 69 76 65 72 73 | 2e 20 20 4d 61 6e 79 20 | drivers|. Many |
|000007e0| 64 65 76 65 6c 6f 70 65 | 72 73 20 61 72 65 20 69 |develope|rs are i|
|000007f0| 6e 74 65 72 65 73 74 65 | 64 20 69 6e 20 61 6c 73 |ntereste|d in als|
|00000800| 6f 20 6d 61 6b 69 6e 67 | 20 74 68 65 69 72 20 4d |o making| their M|
|00000810| 61 63 69 6e 74 6f 73 68 | 20 70 65 72 69 70 68 65 |acintosh| periphe|
|00000820| 72 61 6c 73 20 61 76 61 | 69 6c 61 62 6c 65 20 74 |rals ava|ilable t|
|00000830| 6f 20 41 2f 55 58 20 63 | 75 73 74 6f 6d 65 72 73 |o A/UX c|ustomers|
|00000840| 2e 20 20 49 66 20 74 68 | 65 20 70 65 72 69 70 68 |. If th|e periph|
|00000850| 65 72 61 6c 20 72 65 71 | 75 69 72 65 73 20 61 20 |eral req|uires a |
|00000860| 63 75 73 74 6f 6d 20 64 | 72 69 76 65 72 20 74 68 |custom d|river th|
|00000870| 61 74 20 61 63 63 65 73 | 73 65 73 20 68 61 72 64 |at acces|ses hard|
|00000880| 77 61 72 65 2c 20 74 68 | 65 20 64 72 69 76 65 72 |ware, th|e driver|
|00000890| 20 6e 65 65 64 73 20 74 | 6f 20 62 65 20 6d 6f 64 | needs t|o be mod|
|000008a0| 69 66 69 65 64 20 74 6f | 20 72 75 6e 20 75 6e 64 |ified to| run und|
|000008b0| 65 72 20 41 2f 55 58 2e | 0d 43 00 06 00 00 0c 00 |er A/UX.|.C......|
|000008c0| 00 14 00 01 0d fe 00 06 | 00 00 0c 00 00 14 00 0f |........|........|
|000008d0| 53 70 6c 69 74 20 44 65 | 63 69 73 69 6f 6e 0d ee |Split De|cision..|
|000008e0| 00 06 00 00 0c 01 00 14 | 00 01 0d ef 00 06 00 00 |........|........|
|000008f0| 0c 00 00 14 02 35 54 68 | 65 20 41 2f 55 58 20 54 |.....5Th|e A/UX T|
|00000900| 6f 6f 6c 62 6f 78 20 72 | 75 6e 73 20 69 6e 20 d2 |oolbox r|uns in .|
|00000910| 75 73 65 72 d3 20 73 70 | 61 63 65 20 69 6e 20 41 |user. sp|ace in A|
|00000920| 2f 55 58 2e 20 20 54 68 | 69 73 20 69 73 20 61 20 |/UX. Th|is is a |
|00000930| 76 69 72 74 75 61 6c 2c | 20 70 72 6f 74 65 63 74 |virtual,| protect|
|00000940| 65 64 20 6d 65 6d 6f 72 | 79 20 73 70 61 63 65 20 |ed memor|y space |
|00000950| 74 68 61 74 20 73 68 61 | 72 65 73 20 74 68 65 20 |that sha|res the |
|00000960| 73 79 73 74 65 6d 20 72 | 65 73 6f 75 72 63 65 73 |system r|esources|
|00000970| 20 77 69 74 68 20 61 6c | 6c 20 6f 74 68 65 72 20 | with al|l other |
|00000980| 70 72 6f 63 65 73 73 65 | 73 20 72 75 6e 6e 69 6e |processe|s runnin|
|00000990| 67 20 69 6e 20 d2 75 73 | 65 72 d3 20 73 70 61 63 |g in .us|er. spac|
|000009a0| 65 2e 20 20 54 68 65 73 | 65 20 70 72 6f 63 65 73 |e. Thes|e proces|
|000009b0| 73 65 73 20 61 72 65 20 | 6e 6f 74 20 61 6c 6c 6f |ses are |not allo|
|000009c0| 77 65 64 20 74 6f 20 61 | 63 63 65 73 73 20 68 61 |wed to a|ccess ha|
|000009d0| 72 64 77 61 72 65 20 64 | 69 72 65 63 74 6c 79 2e |rdware d|irectly.|
|000009e0| 20 20 49 6e 73 74 65 61 | 64 2c 20 74 68 65 79 20 | Instea|d, they |
|000009f0| 6d 75 73 74 20 6d 61 6b | 65 20 61 20 72 65 71 75 |must mak|e a requ|
|00000a00| 65 73 74 20 74 6f 20 74 | 68 65 20 41 2f 55 58 20 |est to t|he A/UX |
|00000a10| 6b 65 72 6e 65 6c 20 20 | 74 68 72 6f 75 67 68 20 |kernel |through |
|00000a20| 61 20 6d 65 63 68 61 6e | 69 73 6d 20 63 61 6c 6c |a mechan|ism call|
|00000a30| 65 64 20 61 20 d2 73 79 | 73 74 65 6d 20 63 61 6c |ed a .sy|stem cal|
|00000a40| 6c d3 20 74 6f 20 64 65 | 61 6c 20 77 69 74 68 20 |l. to de|al with |
|00000a50| 74 68 65 20 68 61 72 64 | 77 61 72 65 2e 20 20 54 |the hard|ware. T|
|00000a60| 68 65 20 6b 65 72 6e 65 | 6c 2c 20 77 68 69 63 68 |he kerne|l, which|
|00000a70| 20 72 75 6e 73 20 69 6e | 20 d2 73 79 73 74 65 6d | runs in| .system|
|00000a80| 20 73 70 61 63 65 2c d3 | 20 74 68 65 6e 20 72 65 | space,.| then re|
|00000a90| 74 75 72 6e 73 20 64 61 | 74 61 2c 20 73 74 61 74 |turns da|ta, stat|
|00000aa0| 75 73 2c 20 65 74 63 2e | 20 62 61 63 6b 20 74 6f |us, etc.| back to|
|00000ab0| 20 74 68 65 20 63 61 6c | 6c 65 72 2e 20 20 54 68 | the cal|ler. Th|
|00000ac0| 65 20 73 79 73 74 65 6d | 20 63 61 6c 6c 20 69 73 |e system| call is|
|00000ad0| 20 61 20 77 65 6c 6c 2d | 64 65 66 69 6e 65 64 20 | a well-|defined |
|00000ae0| 69 6e 74 65 72 66 61 63 | 65 20 74 68 61 74 20 67 |interfac|e that g|
|00000af0| 69 76 65 73 20 55 6e 69 | 78 a8 20 73 79 73 74 65 |ives Uni|x. syste|
|00000b00| 6d 73 20 73 6f 6d 65 20 | 64 65 67 72 65 65 20 6f |ms some |degree o|
|00000b10| 66 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 70 6f |f applic|ation po|
|00000b20| 72 74 61 62 69 6c 69 74 | 79 2e 0d 4d 00 12 00 00 |rtabilit|y..M....|
|00000b30| 0c 00 00 14 02 03 09 20 | 00 14 02 04 0c 00 00 14 |....... |........|
|00000b40| 00 01 0d 61 00 06 00 00 | 0c 00 00 14 01 db 53 69 |...a....|......Si|
|00000b50| 6e 63 65 20 61 6e 79 20 | 63 75 73 74 6f 6d 20 64 |nce any |custom d|
|00000b60| 72 69 76 65 72 20 63 6f | 64 65 20 6d 75 73 74 20 |river co|de must |
|00000b70| 6d 61 69 6e 74 61 69 6e | 20 74 68 65 20 4d 61 63 |maintain| the Mac|
|00000b80| 69 6e 74 6f 73 68 20 69 | 6e 74 65 72 66 61 63 65 |intosh i|nterface|
|00000b90| 20 61 74 20 74 68 65 20 | 54 6f 6f 6c 62 6f 78 20 | at the |Toolbox |
|00000ba0| 61 6e 64 20 61 70 70 6c | 69 63 61 74 69 6f 6e 20 |and appl|ication |
|00000bb0| 6c 65 76 65 6c 2c 20 61 | 6e 64 20 54 6f 6f 6c 62 |level, a|nd Toolb|
|00000bc0| 6f 78 20 63 6f 64 65 20 | 63 61 6e 6e 6f 74 20 74 |ox code |cannot t|
|00000bd0| 6f 75 63 68 20 74 68 65 | 20 68 61 72 64 77 61 72 |ouch the| hardwar|
|00000be0| 65 2c 20 79 6f 75 20 6d | 75 73 74 20 73 70 6c 69 |e, you m|ust spli|
|00000bf0| 74 20 79 6f 75 72 20 64 | 72 69 76 65 72 20 69 6e |t your d|river in|
|00000c00| 74 6f 20 74 77 6f 20 70 | 69 65 63 65 73 2e 20 20 |to two p|ieces. |
|00000c10| 54 68 65 20 68 69 67 68 | 2d 6c 65 76 65 6c 20 4d |The high|-level M|
|00000c20| 61 63 69 6e 74 6f 73 68 | 20 69 6e 74 65 72 66 61 |acintosh| interfa|
|00000c30| 63 65 20 70 6f 72 74 69 | 6f 6e 20 73 74 61 79 73 |ce porti|on stays|
|00000c40| 20 69 6e 20 75 73 65 72 | 20 73 70 61 63 65 2c 20 | in user| space, |
|00000c50| 61 6e 64 20 74 68 65 20 | 6c 6f 77 2d 6c 65 76 65 |and the |low-leve|
|00000c60| 6c 20 68 61 72 64 77 61 | 72 65 20 64 65 70 65 6e |l hardwa|re depen|
|00000c70| 64 65 6e 74 2c 20 55 6e | 69 78 2d 73 74 79 6c 65 |dent, Un|ix-style|
|00000c80| 20 69 6e 74 65 72 66 61 | 63 65 20 62 65 63 6f 6d | interfa|ce becom|
|00000c90| 65 73 20 61 20 55 6e 69 | 78 20 64 65 76 69 63 65 |es a Uni|x device|
|00000ca0| 20 64 72 69 76 65 72 20 | 69 6e 20 74 68 65 20 6b | driver |in the k|
|00000cb0| 65 72 6e 65 6c 2e 20 20 | 53 6f 20 68 6f 77 20 64 |ernel. |So how d|
|00000cc0| 6f 20 74 68 65 73 65 20 | 74 77 6f 20 70 69 65 63 |o these |two piec|
|00000cd0| 65 73 20 63 6f 6d 6d 75 | 6e 69 63 61 74 65 3f 20 |es commu|nicate? |
|00000ce0| 20 54 68 65 79 20 68 61 | 76 65 20 74 6f 20 74 61 | They ha|ve to ta|
|00000cf0| 6c 6b 20 74 6f 20 65 61 | 63 68 20 6f 74 68 65 72 |lk to ea|ch other|
|00000d00| 20 74 68 72 6f 75 67 68 | 20 74 68 65 20 55 6e 69 | through| the Uni|
|00000d10| 78 20 73 79 73 74 65 6d | 20 63 61 6c 6c 20 69 6e |x system| call in|
|00000d20| 74 65 72 66 61 63 65 2e | 0d ff 00 06 00 00 0c 00 |terface.|........|
|00000d30| 00 14 00 01 0d ff 00 06 | 00 00 0c 00 00 14 01 d9 |........|........|
|00000d40| 54 68 65 20 63 6f 64 65 | 20 63 6f 6d 70 72 69 73 |The code| compris|
|00000d50| 69 6e 67 20 74 68 65 20 | 6b 65 72 6e 65 6c 20 70 |ing the |kernel p|
|00000d60| 6f 72 74 69 6f 6e 20 6f | 66 20 79 6f 75 72 20 64 |ortion o|f your d|
|00000d70| 72 69 76 65 72 20 6d 75 | 73 74 20 62 65 20 61 64 |river mu|st be ad|
|00000d80| 61 70 74 65 64 20 74 6f | 20 64 6f 20 74 68 69 6e |apted to| do thin|
|00000d90| 67 73 20 69 6e 20 61 20 | d2 55 6e 69 78 20 77 61 |gs in a |.Unix wa|
|00000da0| 79 2c d3 20 73 75 63 68 | 20 61 73 20 70 72 6f 76 |y,. such| as prov|
|00000db0| 69 64 69 6e 67 20 74 68 | 65 20 73 74 61 6e 64 61 |iding th|e standa|
|00000dc0| 72 64 20 72 6f 75 74 69 | 6e 65 20 69 6e 74 65 72 |rd routi|ne inter|
|00000dd0| 66 61 63 65 20 72 65 71 | 75 69 72 65 64 20 6f 66 |face req|uired of|
|00000de0| 20 61 6c 6c 20 55 6e 69 | 78 20 64 72 69 76 65 72 | all Uni|x driver|
|00000df0| 73 2c 20 62 65 20 6d 75 | 6c 74 69 74 68 72 65 61 |s, be mu|ltithrea|
|00000e00| 64 65 64 20 61 6e 64 20 | 72 65 65 6e 74 72 61 6e |ded and |reentran|
|00000e10| 74 2c 20 61 6e 64 20 6e | 6f 74 20 d2 68 6f 67 d3 |t, and n|ot .hog.|
|00000e20| 20 43 50 55 20 74 69 6d | 65 20 62 79 20 64 6f 69 | CPU tim|e by doi|
|00000e30| 6e 67 20 d2 62 75 73 79 | 20 77 61 69 74 73 2e d3 |ng .busy| waits..|
|00000e40| 20 20 54 68 69 73 20 4e | 6f 74 65 20 64 6f 65 73 | This N|ote does|
|00000e50| 20 6e 6f 74 20 63 6f 76 | 65 72 20 74 68 65 73 65 | not cov|er these|
|00000e60| 20 69 73 73 75 65 73 2c | 20 62 75 74 20 74 68 65 | issues,| but the|
|00000e70| 20 41 2f 55 58 20 44 65 | 76 69 63 65 20 44 72 69 | A/UX De|vice Dri|
|00000e80| 76 65 72 73 20 4b 69 74 | 20 28 61 76 61 69 6c 61 |vers Kit| (availa|
|00000e90| 62 6c 65 20 74 68 72 6f | 75 67 68 20 41 50 44 41 |ble thro|ugh APDA|
|00000ea0| 29 20 68 61 73 20 65 78 | 61 6d 70 6c 65 20 63 6f |) has ex|ample co|
|00000eb0| 64 65 20 61 6e 64 20 64 | 6f 63 75 6d 65 6e 74 61 |de and d|ocumenta|
|00000ec0| 74 69 6f 6e 20 61 62 6f | 75 74 20 74 68 65 20 74 |tion abo|ut the t|
|00000ed0| 6f 70 69 63 2e 20 20 54 | 68 65 72 65 20 61 72 65 |opic. T|here are|
|00000ee0| 20 61 6c 73 6f 20 73 6f | 6d 65 20 67 6f 6f 64 20 | also so|me good |
|00000ef0| 62 6f 6f 6b 73 20 61 76 | 61 69 6c 61 62 6c 65 20 |books av|ailable |
|00000f00| 6f 6e 20 77 72 69 74 69 | 6e 67 20 55 6e 69 78 20 |on writi|ng Unix |
|00000f10| 64 72 69 76 65 72 73 2e | 0d ff 00 06 00 00 0c 00 |drivers.|........|
|00000f20| 00 14 00 01 0d ff 00 06 | 00 00 0c 00 00 14 00 00 |........|........|
|00000f30| 01 e6 03 0a 00 00 00 00 | 00 24 00 48 00 6c 00 90 |........|.$.H.l..|
|00000f40| 00 b4 00 d8 00 fc 01 20 | 01 44 01 68 00 00 00 00 |....... |.D.h....|
|00000f50| 00 00 00 00 00 20 03 e8 | 00 0d 4d 41 47 49 43 50 |..... ..|..MAGICP|
|00000f60| 49 43 11 01 ff 96 00 16 | 49 73 20 54 68 69 73 20 |IC......|Is This |
|00000f70| 41 2f 55 58 20 6f 72 20 | 57 68 61 74 3f 0d 00 06 |A/UX or |What?...|
|00000f80| 00 00 0c 01 00 14 00 01 | 0d ff 00 06 00 00 0c 00 |........|........|
|00000f90| 00 14 01 dd 49 66 20 79 | 6f 75 20 77 61 6e 74 20 |....If y|ou want |
|00000fa0| 79 6f 75 72 20 63 6f 64 | 65 20 74 6f 20 77 6f 72 |your cod|e to wor|
|00000fb0| 6b 20 69 6e 20 65 69 74 | 68 65 72 20 65 6e 76 69 |k in eit|her envi|
|00000fc0| 72 6f 6e 6d 65 6e 74 20 | 77 69 74 68 6f 75 74 20 |ronment |without |
|00000fd0| 63 68 61 6e 67 65 2c 20 | 79 6f 75 20 66 69 72 73 |change, |you firs|
|00000fe0| 74 20 6e 65 65 64 20 74 | 6f 20 64 65 74 65 72 6d |t need t|o determ|
|00000ff0| 69 6e 65 20 69 66 20 79 | 6f 75 20 61 72 65 20 75 |ine if y|ou are u|
|00001000| 6e 64 65 72 20 41 2f 55 | 58 20 61 74 20 72 75 6e |nder A/U|X at run|
|00001010| 20 74 69 6d 65 2e 20 20 | 54 68 65 20 62 65 73 74 | time. |The best|
|00001020| 20 77 61 79 20 74 6f 20 | 64 6f 20 74 68 69 73 20 | way to |do this |
|00001030| 69 73 20 77 69 74 68 20 | 74 68 65 20 5f 47 65 73 |is with |the _Ges|
|00001040| 74 61 6c 74 20 74 72 61 | 70 20 75 73 69 6e 67 20 |talt tra|p using |
|00001050| 74 68 65 20 73 65 6c 65 | 63 74 6f 72 20 67 65 73 |the sele|ctor ges|
|00001060| 74 61 6c 74 41 55 58 56 | 65 72 73 69 6f 6e 20 74 |taltAUXV|ersion t|
|00001070| 6f 20 64 65 74 65 72 6d | 69 6e 65 20 69 66 20 41 |o determ|ine if A|
|00001080| 2f 55 58 20 69 73 20 74 | 68 65 20 75 6e 64 65 72 |/UX is t|he under|
|00001090| 6c 79 69 6e 67 20 6f 70 | 65 72 61 74 69 6e 67 20 |lying op|erating |
|000010a0| 73 79 73 74 65 6d 2e 20 | 20 53 68 6f 77 6e 20 62 |system. | Shown b|
|000010b0| 65 6c 6f 77 20 69 73 20 | 61 20 66 75 6e 63 74 69 |elow is |a functi|
|000010c0| 6f 6e 20 77 68 69 63 68 | 20 72 65 74 75 72 6e 73 |on which| returns|
|000010d0| 20 30 20 69 66 20 41 2f | 55 58 20 69 73 20 6e 6f | 0 if A/|UX is no|
|000010e0| 74 20 70 72 65 73 65 6e | 74 2c 20 6f 74 68 65 72 |t presen|t, other|
|000010f0| 77 69 73 65 20 72 65 74 | 75 72 6e 73 20 74 68 65 |wise ret|urns the|
|00001100| 20 6d 61 6a 6f 72 20 41 | 2f 55 58 20 76 65 72 73 | major A|/UX vers|
|00001110| 69 6f 6e 20 6e 75 6d 62 | 65 72 20 28 31 2c 20 32 |ion numb|er (1, 2|
|00001120| 2c 20 65 74 63 2e 29 2e | 20 20 54 68 69 73 20 63 |, etc.).| This c|
|00001130| 6f 64 65 20 72 65 6c 69 | 65 73 20 6f 6e 20 5f 47 |ode reli|es on _G|
|00001140| 65 73 74 61 6c 74 20 67 | 6c 75 65 20 63 6f 64 65 |estalt g|lue code|
|00001150| 20 61 76 61 69 6c 61 62 | 6c 65 20 69 6e 20 4d 50 | availab|le in MP|
|00001160| 57 20 33 2e 32 20 61 6e | 64 20 6c 61 74 65 72 2e |W 3.2 an|d later.|
|00001170| 0d ff 00 2a 00 00 0c 00 | 00 14 00 a8 0c 00 00 16 |...*....|........|
|00001180| 00 b0 0c 00 00 14 00 c9 | 0c 00 00 16 00 da 0c 00 |........|........|
|00001190| 00 14 01 aa 0c 00 00 16 | 01 b2 0c 00 00 14 00 01 |........|........|
|000011a0| 0d ff 00 06 00 00 0c 00 | 00 14 00 00 01 e6 00 0a |........|........|
|000011b0| 00 00 00 00 00 24 00 48 | 00 6c 00 90 00 b4 00 d8 |.....$.H|.l......|
|000011c0| 00 fc 01 20 01 44 01 68 | 00 00 00 00 00 03 2f 2a |... .D.h|....../*|
|000011d0| 0d ff 00 06 00 00 09 00 | 00 16 00 16 20 2a 20 20 |........|.... * |
|000011e0| 20 20 67 65 74 41 55 58 | 56 65 72 73 69 6f 6e 2e | getAUX|Version.|
|000011f0| 63 0d 00 06 00 00 09 00 | 00 16 00 03 20 2a 0d 44 |c.......|.... *.D|
|00001200| 00 06 00 00 09 00 00 16 | 00 2c 20 2a 20 20 20 20 |........|., * |
|00001210| 43 6f 70 79 72 69 67 68 | 74 20 a9 20 31 39 39 30 |Copyrigh|t . 1990|
|00001220| 20 41 70 70 6c 65 20 43 | 6f 6d 70 75 74 65 72 2c | Apple C|omputer,|
|00001230| 20 49 6e 63 2e 0d 00 06 | 00 00 09 00 00 16 00 03 | Inc....|........|
|00001240| 20 2a 0d 68 00 06 00 00 | 09 00 00 16 00 47 20 2a | *.h....|.....G *|
|00001250| 20 20 20 20 54 68 69 73 | 20 66 69 6c 65 20 63 6f | This| file co|
|00001260| 6e 74 61 69 6e 73 20 72 | 6f 75 74 69 6e 65 73 20 |ntains r|outines |
|00001270| 74 6f 20 74 65 73 74 20 | 69 66 20 61 6e 20 61 70 |to test |if an ap|
|00001280| 70 6c 69 63 61 74 69 6f | 6e 20 69 73 20 72 75 6e |plicatio|n is run|
|00001290| 6e 69 6e 67 0d 6e 00 06 | 00 00 09 00 00 16 00 4a |ning.n..|.......J|
|000012a0| 20 2a 20 20 20 20 6f 6e | 20 41 2f 55 58 2e 20 20 | * on| A/UX. |
|000012b0| 49 66 20 74 68 65 20 47 | 65 73 74 61 6c 74 20 74 |If the G|estalt t|
|000012c0| 72 61 70 20 69 73 20 61 | 76 61 69 6c 61 62 6c 65 |rap is a|vailable|
|000012d0| 2c 20 69 74 20 75 73 65 | 73 20 74 68 61 74 2c 20 |, it use|s that, |
|000012e0| 6f 74 68 65 72 77 69 73 | 65 0d 00 06 00 00 09 00 |otherwis|e.......|
|000012f0| 00 16 00 48 20 2a 20 20 | 20 20 69 74 20 66 61 6c |...H * | it fal|
|00001300| 6c 73 20 62 61 63 6b 20 | 74 6f 20 48 57 43 66 67 |ls back |to HWCfg|
|00001310| 46 6c 61 67 73 2c 20 77 | 68 69 63 68 20 77 69 6c |Flags, w|hich wil|
|00001320| 6c 20 77 6f 72 6b 20 6f | 6e 20 61 6c 6c 20 41 2f |l work o|n all A/|
|00001330| 55 58 20 73 79 73 74 65 | 6d 73 2e 0d 00 06 00 00 |UX syste|ms......|
|00001340| 09 00 00 16 00 04 20 2a | 2f 0d 00 06 00 00 09 00 |...... *|/.......|
|00001350| 00 16 00 13 23 69 6e 63 | 6c 75 64 65 20 3c 54 79 |....#inc|lude <Ty|
|00001360| 70 65 73 2e 68 3e 0d 0d | 00 06 00 00 09 00 00 16 |pes.h>..|........|
|00001370| 00 18 23 69 6e 63 6c 75 | 64 65 20 3c 47 65 73 74 |..#inclu|de <Gest|
|00001380| 61 6c 74 45 71 75 2e 68 | 3e 0d 00 06 00 00 09 00 |altEqu.h|>.......|
|00001390| 00 16 00 01 0d 61 00 06 | 00 00 09 00 00 16 00 58 |.....a..|.......X|
|000013a0| 23 64 65 66 69 6e 65 20 | 48 57 43 66 67 46 6c 61 |#define |HWCfgFla|
|000013b0| 67 73 20 20 20 20 30 78 | 42 32 32 20 20 20 20 2f |gs 0x|B22 /|
|000013c0| 2a 20 4c 6f 77 20 6d 65 | 6d 6f 72 79 20 67 6c 6f |* Low me|mory glo|
|000013d0| 62 61 6c 20 75 73 65 64 | 20 74 6f 20 63 68 65 63 |bal used| to chec|
|000013e0| 6b 20 69 66 20 41 2f 55 | 58 20 69 73 20 72 75 6e |k if A/U|X is run|
|000013f0| 6e 69 6e 67 20 2a 2f 0d | 00 06 00 00 09 00 00 16 |ning */.|........|
|00001400| 00 01 0d 02 00 06 00 00 | 09 00 00 16 00 03 2f 2a |........|....../*|
|00001410| 0d 00 00 06 00 00 09 00 | 00 16 00 59 20 2a 20 20 |........|...Y * |
|00001420| 20 20 67 65 74 41 55 58 | 56 65 72 73 69 6f 6e 20 | getAUX|Version |
|00001430| 2d 2d 20 43 68 65 63 6b | 73 20 66 6f 72 20 74 68 |-- Check|s for th|
|00001440| 65 20 70 72 65 73 65 6e | 63 65 20 6f 66 20 41 2f |e presen|ce of A/|
|00001450| 55 58 20 62 79 20 77 68 | 61 74 65 76 65 72 20 6d |UX by wh|atever m|
|00001460| 65 61 6e 73 20 69 73 20 | 61 70 70 72 6f 70 72 69 |eans is |appropri|
|00001470| 61 74 65 2e 0d 68 00 06 | 00 00 09 00 00 16 00 55 |ate..h..|.......U|
|00001480| 20 2a 20 20 20 20 52 65 | 74 75 72 6e 73 20 74 68 | * Re|turns th|
|00001490| 65 20 6d 61 6a 6f 72 20 | 76 65 72 73 69 6f 6e 20 |e major |version |
|000014a0| 6e 75 6d 62 65 72 20 6f | 66 20 41 2f 55 58 20 28 |number o|f A/UX (|
|000014b0| 69 2e 65 2e 20 30 20 69 | 66 20 41 2f 55 58 20 69 |i.e. 0 i|f A/UX i|
|000014c0| 73 20 6e 6f 74 20 70 72 | 65 73 65 6e 74 2c 20 31 |s not pr|esent, 1|
|000014d0| 20 66 6f 72 0d 55 00 06 | 00 00 09 00 00 16 00 34 | for.U..|.......4|
|000014e0| 20 2a 20 20 20 20 61 6e | 79 20 31 2e 78 2e 78 20 | * an|y 1.x.x |
|000014f0| 76 65 72 73 69 6f 6e 20 | 32 20 66 6f 72 20 61 6e |version |2 for an|
|00001500| 79 20 32 2e 78 20 76 65 | 72 73 69 6f 6e 2c 20 65 |y 2.x ve|rsion, e|
|00001510| 74 63 2e 0d 00 06 00 00 | 09 00 00 16 00 03 20 2a |tc......|...... *|
|00001520| 0d 01 00 06 00 00 09 00 | 00 16 00 4b 20 2a 20 20 |........|...K * |
|00001530| 20 20 54 68 69 73 20 63 | 6f 64 65 20 73 68 6f 75 | This c|ode shou|
|00001540| 6c 64 20 77 6f 72 6b 20 | 66 6f 72 20 61 6c 6c 20 |ld work |for all |
|00001550| 70 61 73 74 2c 20 70 72 | 65 73 65 6e 74 20 61 6e |past, pr|esent an|
|00001560| 64 20 66 75 74 75 72 65 | 20 41 2f 55 58 20 73 79 |d future| A/UX sy|
|00001570| 73 74 65 6d 73 2e 0d 06 | 00 06 00 00 09 00 00 16 |stems...|........|
|00001580| 00 04 20 2a 2f 0d 00 06 | 00 00 09 00 00 16 00 17 |.. */...|........|
|00001590| 73 68 6f 72 74 20 67 65 | 74 41 55 58 56 65 72 73 |short ge|tAUXVers|
|000015a0| 69 6f 6e 20 28 29 0d 00 | 00 06 00 00 09 00 00 16 |ion ()..|........|
|000015b0| 00 02 7b 0d 00 06 00 00 | 09 00 00 16 00 19 20 20 |..{.....|...... |
|000015c0| 20 20 6c 6f 6e 67 20 20 | 20 20 20 61 75 78 76 65 | long | auxve|
|000015d0| 72 73 69 6f 6e 3b 0d 03 | 00 06 00 00 09 00 00 16 |rsion;..|........|
|000015e0| 00 12 20 20 20 20 73 68 | 6f 72 74 20 20 20 20 65 |.. sh|ort e|
|000015f0| 72 72 3b 0d 00 06 00 00 | 09 00 00 16 00 17 20 20 |rr;.....|...... |
|00001600| 20 20 73 68 6f 72 74 20 | 20 20 20 2a 66 6c 61 67 | short | *flag|
|00001610| 70 74 72 3b 0d ff 00 06 | 00 00 09 00 00 16 00 01 |ptr;....|........|
|00001620| 0d ff 00 06 00 00 09 00 | 00 16 00 07 20 20 20 20 |........|.... |
|00001630| 2f 2a 0d ff 00 06 00 00 | 09 00 00 16 00 55 20 20 |/*......|.....U |
|00001640| 20 20 20 2a 20 20 20 20 | 54 68 69 73 20 63 6f 64 | * |This cod|
|00001650| 65 20 61 73 73 75 6d 65 | 73 20 74 68 65 20 47 65 |e assume|s the Ge|
|00001660| 73 74 61 6c 74 20 67 6c | 75 65 20 63 68 65 63 6b |stalt gl|ue check|
|00001670| 73 20 66 6f 72 20 74 68 | 65 20 70 72 65 73 65 6e |s for th|e presen|
|00001680| 63 65 20 6f 66 20 74 68 | 65 20 5f 47 65 73 74 61 |ce of th|e _Gesta|
|00001690| 6c 74 0d 03 00 06 00 00 | 09 00 00 16 00 4f 20 20 |lt......|.....O |
|000016a0| 20 20 20 2a 20 20 20 20 | 74 72 61 70 20 61 6e 64 | * |trap and|
|000016b0| 20 64 6f 65 73 20 73 6f | 6d 65 74 68 69 6e 67 20 | does so|mething |
|000016c0| 69 6e 74 65 6c 6c 69 67 | 65 6e 74 20 69 66 20 74 |intellig|ent if t|
|000016d0| 68 65 20 74 72 61 70 20 | 69 73 20 75 6e 61 76 61 |he trap |is unava|
|000016e0| 69 6c 61 62 6c 65 2c 20 | 69 2e 65 2e 0d 24 00 06 |ilable, |i.e..$..|
|000016f0| 00 00 09 00 00 16 00 23 | 20 20 20 20 20 2a 20 20 |.......#| * |
|00001700| 20 20 72 65 74 75 72 6e | 20 75 6e 6b 6e 6f 77 6e | return| unknown|
|00001710| 20 73 65 6c 65 63 74 6f | 72 2e 0d 01 00 06 00 00 | selecto|r.......|
|00001720| 09 00 00 16 00 08 20 20 | 20 20 20 2a 2f 0d 00 06 |...... | */...|
|00001730| 00 00 09 00 00 16 00 14 | 20 20 20 20 61 75 78 76 |........| auxv|
|00001740| 65 72 73 69 6f 6e 20 3d | 20 30 3b 0d 00 06 00 00 |ersion =| 0;.....|
|00001750| 09 00 00 16 00 34 20 20 | 20 20 65 72 72 20 3d 20 |.....4 | err = |
|00001760| 47 65 73 74 61 6c 74 20 | 28 67 65 73 74 61 6c 74 |Gestalt |(gestalt|
|00001770| 41 55 58 56 65 72 73 69 | 6f 6e 2c 20 26 61 75 78 |AUXVersi|on, &aux|
|00001780| 76 65 72 73 69 6f 6e 29 | 3b 0d 00 06 00 00 09 00 |version)|;.......|
|00001790| 00 16 00 07 20 20 20 20 | 2f 2a 0d d8 00 06 00 00 |.... |/*......|
|000017a0| 09 00 00 16 00 55 20 20 | 20 20 20 2a 20 20 20 20 |.....U | * |
|000017b0| 49 66 20 67 65 73 74 61 | 6c 74 55 6e 6b 6e 6f 77 |If gesta|ltUnknow|
|000017c0| 6e 45 72 72 20 6f 72 20 | 67 65 73 74 61 6c 74 55 |nErr or |gestaltU|
|000017d0| 6e 64 65 66 53 65 6c 65 | 63 74 6f 72 45 72 72 20 |ndefSele|ctorErr |
|000017e0| 77 61 73 20 72 65 74 75 | 72 6e 65 64 2c 20 74 68 |was retu|rned, th|
|000017f0| 65 6e 20 65 69 74 68 65 | 72 20 0d 6c 00 06 00 00 |en eithe|r .l....|
|00001800| 09 00 00 16 00 52 20 20 | 20 20 20 2a 20 20 20 20 |.....R | * |
|00001810| 77 65 20 77 65 72 65 6e | 27 74 20 72 75 6e 6e 69 |we weren|'t runni|
|00001820| 6e 67 20 6f 6e 20 41 2f | 55 58 2c 20 6f 72 20 74 |ng on A/|UX, or t|
|00001830| 68 65 20 5f 47 65 73 74 | 61 6c 74 20 74 72 61 70 |he _Gest|alt trap|
|00001840| 20 69 73 20 75 6e 61 76 | 61 69 6c 61 62 6c 65 20 | is unav|ailable |
|00001850| 73 6f 20 75 73 65 20 0d | 00 06 00 00 09 00 00 16 |so use .|........|
|00001860| 00 1e 20 20 20 20 20 2a | 20 20 20 20 48 57 43 66 |.. *| HWCf|
|00001870| 67 46 6c 61 67 73 20 69 | 6e 73 74 65 61 64 2e 0d |gFlags i|nstead..|
|00001880| 00 06 00 00 09 00 00 16 | 00 43 20 20 20 20 20 2a |........|.C *|
|00001890| 20 20 20 20 41 6c 6c 20 | 6f 74 68 65 72 20 65 72 | All |other er|
|000018a0| 72 6f 72 73 20 61 72 65 | 20 69 67 6e 6f 72 65 64 |rors are| ignored|
|000018b0| 20 28 69 6d 70 6c 69 65 | 73 20 41 2f 55 58 20 6e | (implie|s A/UX n|
|000018c0| 6f 74 20 70 72 65 73 65 | 6e 74 29 2e 0d ff 00 06 |ot prese|nt).....|
|000018d0| 00 00 09 00 00 16 00 08 | 20 20 20 20 20 2a 2f 0d |........| */.|
|000018e0| 00 06 00 00 09 00 00 16 | 00 46 20 20 20 20 69 66 |........|.F if|
|000018f0| 20 28 65 72 72 20 3d 3d | 20 67 65 73 74 61 6c 74 | (err ==| gestalt|
|00001900| 55 6e 6b 6e 6f 77 6e 45 | 72 72 20 7c 7c 20 65 72 |UnknownE|rr || er|
|00001910| 72 20 3d 3d 20 67 65 73 | 74 61 6c 74 55 6e 64 65 |r == ges|taltUnde|
|00001920| 66 53 65 6c 65 63 74 6f | 72 45 72 72 29 20 7b 0d |fSelecto|rErr) {.|
|00001930| 00 06 00 00 09 00 00 16 | 00 40 20 20 20 20 20 20 |........|.@ |
|00001940| 20 20 66 6c 61 67 70 74 | 72 20 3d 20 28 73 68 6f | flagpt|r = (sho|
|00001950| 72 74 20 2a 29 20 48 57 | 43 66 67 46 6c 61 67 73 |rt *) HW|CfgFlags|
|00001960| 3b 20 20 20 20 2f 2a 20 | 55 73 65 20 48 57 43 66 |; /* |Use HWCf|
|00001970| 67 46 6c 61 67 73 20 2a | 2f 0d 00 06 00 00 09 00 |gFlags *|/.......|
|00001980| 00 16 00 21 20 20 20 20 | 20 20 20 20 69 66 20 28 |...! | if (|
|00001990| 2a 66 6c 61 67 70 74 72 | 20 26 20 28 31 20 3c 3c |*flagptr| & (1 <<|
|000019a0| 20 39 29 29 0d ff 00 06 | 00 00 09 00 00 16 00 53 | 9))....|.......S|
|000019b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 61 75 78 76 | | auxv|
|000019c0| 65 72 73 69 6f 6e 20 3d | 20 30 78 31 30 30 3b 20 |ersion =| 0x100; |
|000019d0| 20 20 20 20 20 20 20 2f | 2a 20 44 6f 20 48 61 76 | /|* Do Hav|
|000019e0| 65 20 41 2f 55 58 2c 20 | 73 6f 20 61 73 73 75 6d |e A/UX, |so assum|
|000019f0| 65 20 76 65 72 73 69 6f | 6e 20 31 2e 78 2e 78 20 |e versio|n 1.x.x |
|00001a00| 2a 2f 0d ff 00 06 00 00 | 09 00 00 16 00 06 20 20 |*/......|...... |
|00001a10| 20 20 7d 0d 00 06 00 00 | 09 00 00 16 00 07 20 20 | }.....|...... |
|00001a20| 20 20 2f 2a 0d ff 00 06 | 00 00 09 00 00 16 00 4b | /*....|.......K|
|00001a30| 20 20 20 20 20 2a 20 20 | 20 20 4e 6f 77 20 72 69 | * | Now ri|
|00001a40| 67 68 74 20 73 68 69 66 | 74 20 61 75 78 76 65 72 |ght shif|t auxver|
|00001a50| 73 69 6f 6e 20 62 79 20 | 38 20 62 69 74 73 20 74 |sion by |8 bits t|
|00001a60| 6f 20 67 65 74 20 6d 61 | 6a 6f 72 20 76 65 72 73 |o get ma|jor vers|
|00001a70| 69 6f 6e 20 6e 75 6d 62 | 65 72 0d 57 00 06 00 00 |ion numb|er.W....|
|00001a80| 09 00 00 16 00 08 20 20 | 20 20 20 2a 2f 0d 00 06 |...... | */...|
|00001a90| 00 00 09 00 00 16 00 16 | 20 20 20 20 61 75 78 76 |........| auxv|
|00001aa0| 65 72 73 69 6f 6e 20 3e | 3e 3d 20 38 3b 0d 00 06 |ersion >|>= 8;...|
|00001ab0| 00 00 09 00 00 16 00 21 | 20 20 20 20 72 65 74 75 |.......!| retu|
|00001ac0| 72 6e 20 28 28 73 68 6f | 72 74 29 20 61 75 78 76 |rn ((sho|rt) auxv|
|00001ad0| 65 72 73 69 6f 6e 29 3b | 0d ff 00 06 00 00 09 00 |ersion);|........|
|00001ae0| 00 16 00 02 7d 0d 00 06 | 00 00 09 00 00 16 00 00 |....}...|........|
|00001af0| 01 e6 03 0a 00 00 00 00 | 00 24 00 48 00 6c 00 90 |........|.$.H.l..|
|00001b00| 00 b4 00 d8 00 fc 01 20 | 01 44 01 68 00 00 00 00 |....... |.D.h....|
|00001b10| 00 01 0d ff 00 06 00 00 | 0c 00 00 14 00 00 01 e6 |........|........|
|00001b20| 03 0a 00 00 00 00 00 24 | 00 48 00 6c 00 90 00 b4 |.......$|.H.l....|
|00001b30| 00 d8 00 fc 01 20 01 44 | 01 68 00 00 00 00 00 01 |..... .D|.h......|
|00001b40| 0d 69 00 06 00 00 0c 00 | 00 14 47 49 43 50 49 43 |.i......|..GICPIC|
|00001b50| 11 01 ff 96 00 16 41 2f | 55 58 20 43 6f 64 65 2c |......A/|UX Code,|
|00001b60| 20 55 6e 64 65 72 20 4d | 50 57 3f 0d 00 06 00 00 | Under M|PW?.....|
|00001b70| 0c 01 00 14 00 01 0d ff | 00 06 00 00 0c 00 00 14 |........|........|
|00001b80| 01 7f 54 68 65 20 6d 61 | 69 6e 20 73 79 73 74 65 |..The ma|in syste|
|00001b90| 6d 20 63 61 6c 6c 73 20 | 75 73 65 64 20 74 6f 20 |m calls |used to |
|00001ba0| 61 63 63 65 73 73 20 6b | 65 72 6e 65 6c 20 64 72 |access k|ernel dr|
|00001bb0| 69 76 65 72 20 72 6f 75 | 74 69 6e 65 73 20 61 72 |iver rou|tines ar|
|00001bc0| 65 20 6f 70 65 6e 28 29 | 2c 20 63 6c 6f 73 65 28 |e open()|, close(|
|00001bd0| 29 2c 20 72 65 61 64 28 | 29 2c 20 77 72 69 74 65 |), read(|), write|
|00001be0| 28 29 2c 20 61 6e 64 20 | 69 6f 63 74 6c 28 29 2e |(), and |ioctl().|
|00001bf0| 20 20 4f 66 20 75 73 65 | 20 74 6f 20 61 70 70 6c | Of use| to appl|
|00001c00| 69 63 61 74 69 6f 6e 73 | 20 69 73 20 74 68 65 20 |ications| is the |
|00001c10| 72 6f 75 74 69 6e 65 20 | 63 72 65 61 74 28 29 20 |routine |creat() |
|00001c20| 77 68 69 63 68 20 69 73 | 20 69 6e 63 6c 75 64 65 |which is| include|
|00001c30| 64 20 68 65 72 65 20 61 | 73 20 77 65 6c 6c 2e 20 |d here a|s well. |
|00001c40| 20 54 68 65 20 41 2f 55 | 58 20 73 79 73 74 65 6d | The A/U|X system|
|00001c50| 20 63 61 6c 6c 20 6d 65 | 63 68 61 6e 69 73 6d 20 | call me|chanism |
|00001c60| 69 73 20 61 20 74 72 61 | 70 20 23 30 20 77 69 74 |is a tra|p #0 wit|
|00001c70| 68 20 74 68 65 20 73 79 | 73 74 65 6d 20 63 61 6c |h the sy|stem cal|
|00001c80| 6c 20 20 73 65 6c 65 63 | 74 6f 72 20 63 6f 64 65 |l selec|tor code|
|00001c90| 20 69 6e 20 72 65 67 69 | 73 74 65 72 20 44 30 2e | in regi|ster D0.|
|00001ca0| 20 20 54 68 65 20 61 72 | 67 75 6d 65 6e 74 73 20 | The ar|guments |
|00001cb0| 61 72 65 20 6f 6e 20 74 | 68 65 20 73 74 61 63 6b |are on t|he stack|
|00001cc0| 20 69 6e 20 74 68 65 20 | 6e 6f 72 6d 61 6c 20 43 | in the |normal C|
|00001cd0| 20 63 61 6c 6c 69 6e 67 | 20 63 6f 6e 76 65 6e 74 | calling| convent|
|00001ce0| 69 6f 6e 2c 20 6c 61 73 | 74 20 61 72 67 75 6d 65 |ion, las|t argume|
|00001cf0| 6e 74 20 70 75 73 68 65 | 64 20 66 69 72 73 74 2e |nt pushe|d first.|
|00001d00| 0d 87 00 66 00 00 0c 00 | 00 14 00 40 0c 00 00 16 |...f....|...@....|
|00001d10| 00 46 0c 00 00 14 00 48 | 0c 00 00 16 00 4f 0c 00 |.F.....H|.....O..|
|00001d20| 00 14 00 51 0c 00 00 16 | 00 57 0c 00 00 14 00 59 |...Q....|.W.....Y|
|00001d30| 0c 00 00 16 00 60 0c 00 | 00 14 00 66 0c 00 00 16 |.....`..|...f....|
|00001d40| 00 6d 0c 00 00 14 00 96 | 0c 00 00 16 00 9d 0c 00 |.m......|........|
|00001d50| 00 14 00 e3 0c 00 00 16 | 00 eb 0c 00 00 14 01 1b |........|........|
|00001d60| 0c 00 00 16 01 1d 0c 00 | 00 14 00 01 0d ff 00 06 |........|........|
|00001d70| 00 00 0c 00 00 14 00 64 | 4e 6f 74 65 20 74 68 61 |.......d|Note tha|
|00001d80| 74 20 64 69 66 66 65 72 | 65 6e 74 20 74 72 61 70 |t differ|ent trap|
|00001d90| 20 63 61 6c 6c 73 20 75 | 6e 64 65 72 20 41 2f 55 | calls u|nder A/U|
|00001da0| 58 20 68 61 76 65 20 64 | 69 66 66 65 72 65 6e 74 |X have d|ifferent|
|00001db0| 20 70 72 6f 63 65 64 75 | 72 65 73 20 63 6f 6e 63 | procedu|res conc|
|00001dc0| 65 72 6e 69 6e 67 20 74 | 68 65 20 75 73 65 20 6f |erning t|he use o|
|00001dd0| 66 20 72 65 67 69 73 74 | 65 72 73 0d 00 06 00 00 |f regist|ers.....|
|00001de0| 0c 00 00 14 01 b1 61 6e | 64 20 73 74 61 63 6b 20 |......an|d stack |
|00001df0| 66 72 61 6d 65 73 2e 49 | 6e 20 74 68 69 73 20 54 |frames.I|n this T|
|00001e00| 65 63 68 20 4e 6f 74 65 | 20 77 65 20 61 72 65 20 |ech Note| we are |
|00001e10| 6e 6f 74 20 74 72 79 69 | 6e 67 20 74 6f 20 64 6f |not tryi|ng to do|
|00001e20| 63 75 6d 65 6e 74 20 65 | 61 63 68 20 70 6f 73 73 |cument e|ach poss|
|00001e30| 69 62 6c 65 20 63 61 73 | 65 2c 20 73 6f 20 77 65 |ible cas|e, so we|
|00001e40| 20 6c 69 6d 69 74 20 74 | 68 65 20 65 78 61 6d 70 | limit t|he examp|
|00001e50| 6c 65 73 20 74 6f 20 73 | 68 6f 77 20 68 6f 77 20 |les to s|how how |
|00001e60| 74 68 65 20 72 65 67 69 | 73 74 65 72 73 20 61 6e |the regi|sters an|
|00001e70| 64 20 73 74 61 63 6b 20 | 66 72 61 6d 65 20 61 72 |d stack |frame ar|
|00001e80| 65 20 75 73 65 64 7c 20 | 77 69 74 68 20 74 68 65 |e used| |with the|
|00001e90| 20 6f 70 65 6e 28 29 2c | 63 6c 6f 73 65 28 29 2c | open(),|close(),|
|00001ea0| 20 72 65 61 64 28 29 2c | 20 77 72 69 74 65 28 29 | read(),| write()|
|00001eb0| 2c 20 66 6f 72 6b 28 29 | 20 61 6e 64 20 69 6f 63 |, fork()| and ioc|
|00001ec0| 74 6c 28 29 20 41 2f 55 | 58 20 73 79 73 74 65 6d |tl() A/U|X system|
|00001ed0| 20 63 61 6c 6c 73 2e 20 | 20 49 6e 20 74 68 65 20 | calls. | In the |
|00001ee0| 63 61 73 65 20 6f 66 20 | 6f 74 68 65 72 20 41 2f |case of |other A/|
|00001ef0| 55 58 20 73 79 73 74 65 | 6d 20 63 61 6c 6c 73 20 |UX syste|m calls |
|00001f00| 79 6f 75 20 68 61 76 65 | 20 74 6f 20 64 69 73 61 |you have| to disa|
|00001f10| 73 73 65 6d 62 6c 65 20 | 63 6f 64 65 20 63 6f 6d |ssemble |code com|
|00001f20| 70 69 6c 65 64 20 75 6e | 64 65 72 20 74 68 65 20 |piled un|der the |
|00001f30| 41 2f 55 58 20 65 6e 76 | 69 72 6f 6e 6d 65 6e 74 |A/UX env|ironment|
|00001f40| 20 69 6e 20 6f 72 64 65 | 72 20 74 6f 20 66 69 6e | in orde|r to fin|
|00001f50| 64 20 6f 75 74 20 68 6f | 77 20 74 68 65 20 70 61 |d out ho|w the pa|
|00001f60| 72 61 6d 65 74 65 72 73 | 20 61 72 65 20 70 61 73 |rameters| are pas|
|00001f70| 73 65 64 2c 20 61 6e 64 | 20 68 6f 77 20 74 68 65 |sed, and| how the|
|00001f80| 20 73 74 61 63 6b 20 66 | 72 61 6d 65 73 20 61 72 | stack f|rames ar|
|00001f90| 65 20 73 65 74 2e 0d 00 | 00 4e 00 00 0c 00 00 14 |e set...|.N......|
|00001fa0| 00 ab 0c 00 00 16 00 b1 | 0c 00 00 14 00 b2 0c 00 |........|........|
|00001fb0| 00 16 00 b9 0c 00 00 14 | 00 bb 0c 00 00 16 00 c1 |........|........|
|00001fc0| 0c 00 00 14 00 c3 0c 00 | 00 16 00 ca 0c 00 00 14 |........|........|
|00001fd0| 00 cc 0c 00 00 16 00 d2 | 0c 00 00 14 00 d7 0c 00 |........|........|
|00001fe0| 00 16 00 de 0c 00 00 14 | 00 01 0d 08 00 06 00 00 |........|........|
|00001ff0| 0c 00 00 14 03 21 53 69 | 6e 63 65 20 4d 50 57 20 |.....!Si|nce MPW |
|00002000| 64 6f 65 73 20 6e 6f 74 | 20 63 6f 6e 74 61 69 6e |does not| contain|
|00002010| 20 61 6e 79 20 41 2f 55 | 58 20 6c 69 62 72 61 72 | any A/U|X librar|
|00002020| 69 65 73 20 61 6e 64 20 | 64 6f 65 73 6e d5 74 20 |ies and |doesn.t |
|00002030| 6b 6e 6f 77 20 61 62 6f | 75 74 20 55 6e 69 78 20 |know abo|ut Unix |
|00002040| 73 79 73 74 65 6d 20 63 | 61 6c 6c 73 2c 20 79 6f |system c|alls, yo|
|00002050| 75 20 6e 65 65 64 20 74 | 6f 20 75 73 65 20 73 6f |u need t|o use so|
|00002060| 6d 65 20 61 73 73 65 6d | 62 6c 79 2d 6c 61 6e 67 |me assem|bly-lang|
|00002070| 75 61 67 65 20 67 6c 75 | 65 20 63 6f 64 65 20 61 |uage glu|e code a|
|00002080| 72 6f 75 6e 64 20 74 68 | 65 20 74 72 61 70 2e 20 |round th|e trap. |
|00002090| 20 46 6f 6c 6c 6f 77 69 | 6e 67 20 69 73 20 67 6c | Followi|ng is gl|
|000020a0| 75 65 20 63 6f 64 65 20 | 66 6f 72 20 74 68 65 20 |ue code |for the |
|000020b0| 63 6f 6d 6d 6f 6e 20 41 | 2f 55 58 20 72 6f 75 74 |common A|/UX rout|
|000020c0| 69 6e 65 73 20 6c 69 73 | 74 65 64 20 61 62 6f 76 |ines lis|ted abov|
|000020d0| 65 2e 20 20 59 6f 75 20 | 63 61 6e 20 65 78 74 65 |e. You |can exte|
|000020e0| 6e 64 20 79 6f 75 72 20 | 41 2f 55 58 20 73 79 73 |nd your |A/UX sys|
|000020f0| 74 65 6d 20 63 61 6c 6c | 20 6c 69 62 72 61 72 79 |tem call| library|
|00002100| 20 62 79 20 61 64 64 69 | 6e 67 20 61 64 64 69 74 | by addi|ng addit|
|00002110| 69 6f 6e 61 6c 20 72 6f | 75 74 69 6e 65 73 20 77 |ional ro|utines w|
|00002120| 69 74 68 20 61 64 64 69 | 74 69 6f 6e 61 6c 20 73 |ith addi|tional s|
|00002130| 79 73 74 65 6d 20 63 61 | 6c 6c 20 73 65 6c 65 63 |ystem ca|ll selec|
|00002140| 74 6f 72 73 2e 20 20 54 | 68 69 73 20 67 6c 75 65 |tors. T|his glue|
|00002150| 20 63 6f 64 65 20 72 65 | 6c 69 65 73 20 6f 6e 20 | code re|lies on |
|00002160| 74 68 65 20 73 69 6d 69 | 6c 61 72 69 74 79 20 62 |the simi|larity b|
|00002170| 65 74 77 65 65 6e 20 41 | 2f 55 58 20 43 20 63 61 |etween A|/UX C ca|
|00002180| 6c 6c 69 6e 67 20 63 6f | 6e 76 65 6e 74 69 6f 6e |lling co|nvention|
|00002190| 73 20 61 6e 64 20 4d 50 | 57 20 43 20 63 61 6c 6c |s and MP|W C call|
|000021a0| 69 6e 67 20 63 6f 6e 76 | 65 6e 74 69 6f 6e 73 2c |ing conv|entions,|
|000021b0| 20 61 73 20 77 65 6c 6c | 20 61 73 20 74 68 65 20 | as well| as the |
|000021c0| 73 69 6d 69 6c 61 72 69 | 74 79 20 69 6e 20 74 68 |similari|ty in th|
|000021d0| 65 20 73 69 7a 65 73 20 | 6f 66 20 70 61 72 61 6d |e sizes |of param|
|000021e0| 65 74 65 72 73 20 28 69 | 6e 74 20 76 61 72 69 61 |eters (i|nt varia|
|000021f0| 62 6c 65 73 20 61 72 65 | 20 66 6f 75 72 20 62 79 |bles are| four by|
|00002200| 74 65 73 20 69 6e 20 62 | 6f 74 68 20 73 79 73 74 |tes in b|oth syst|
|00002210| 65 6d 73 29 2e 20 20 57 | 68 65 6e 20 74 68 65 73 |ems). W|hen thes|
|00002220| 65 20 72 6f 75 74 69 6e | 65 73 20 61 72 65 20 65 |e routin|es are e|
|00002230| 6e 74 65 72 65 64 20 74 | 68 65 20 73 74 61 63 6b |ntered t|he stack|
|00002240| 20 66 72 61 6d 65 20 69 | 73 20 61 6c 72 65 61 64 | frame i|s alread|
|00002250| 79 20 63 6f 72 72 65 63 | 74 6c 79 20 73 65 74 20 |y correc|tly set |
|00002260| 75 70 20 66 6f 72 20 74 | 68 65 20 74 72 61 70 20 |up for t|he trap |
|00002270| 23 30 3b 20 69 66 20 79 | 6f 75 20 61 72 65 20 75 |#0; if y|ou are u|
|00002280| 73 69 6e 67 20 6f 74 68 | 65 72 20 6c 61 6e 67 75 |sing oth|er langu|
|00002290| 61 67 65 73 20 6f 72 20 | 64 65 76 65 6c 6f 70 6d |ages or |developm|
|000022a0| 65 6e 74 20 73 79 73 74 | 65 6d 73 2c 20 79 6f 75 |ent syst|ems, you|
|000022b0| 20 6d 61 79 20 6e 65 65 | 64 20 74 6f 20 65 78 74 | may nee|d to ext|
|000022c0| 65 6e 64 20 74 68 65 20 | 67 6c 75 65 20 74 6f 20 |end the |glue to |
|000022d0| 72 65 61 72 72 61 6e 67 | 65 20 70 61 72 61 6d 65 |rearrang|e parame|
|000022e0| 74 65 72 73 20 6f 6e 20 | 74 68 65 20 73 74 61 63 |ters on |the stac|
|000022f0| 6b 20 74 6f 20 6d 61 74 | 63 68 20 41 2f 55 58 20 |k to mat|ch A/UX |
|00002300| 43 20 63 61 6c 6c 69 6e | 67 20 63 6f 6e 76 65 6e |C callin|g conven|
|00002310| 74 69 6f 6e 73 2e 0d 6c | 00 1e 00 00 0c 00 00 14 |tions..l|........|
|00002320| 01 f1 0c 00 00 16 01 f4 | 0c 00 00 14 02 75 0c 00 |........|.....u..|
|00002330| 00 16 02 7c 0c 00 00 14 | 00 01 0d 00 00 06 00 00 |...|....|........|
|00002340| 0c 00 00 14 03 77 54 68 | 65 20 65 72 72 6f 72 20 |.....wTh|e error |
|00002350| 63 6f 64 65 20 66 72 6f | 6d 20 74 68 65 20 63 61 |code fro|m the ca|
|00002360| 6c 6c 20 69 73 20 72 65 | 74 75 72 6e 65 64 20 69 |ll is re|turned i|
|00002370| 6e 20 44 30 2e 20 20 49 | 6e 20 74 68 65 20 55 6e |n D0. I|n the Un|
|00002380| 69 78 20 65 6e 76 69 72 | 6f 6e 6d 65 6e 74 2c 20 |ix envir|onment, |
|00002390| 74 68 69 73 20 65 72 72 | 6f 72 20 63 6f 64 65 20 |this err|or code |
|000023a0| 69 73 20 6e 6f 72 6d 61 | 6c 6c 79 20 70 6c 61 63 |is norma|lly plac|
|000023b0| 65 64 20 69 6e 20 74 68 | 65 20 65 72 72 6e 6f 20 |ed in th|e errno |
|000023c0| 67 6c 6f 62 61 6c 20 76 | 61 72 69 61 62 6c 65 20 |global v|ariable |
|000023d0| 61 6e 64 20 44 30 20 69 | 73 20 73 65 74 20 74 6f |and D0 i|s set to|
|000023e0| 20 2d 31 20 62 65 66 6f | 72 65 20 72 65 74 75 72 | -1 befo|re retur|
|000023f0| 6e 20 74 6f 20 74 68 65 | 20 63 61 6c 6c 65 72 2e |n to the| caller.|
|00002400| 20 20 53 69 6e 63 65 20 | 67 6c 6f 62 61 6c 20 76 | Since |global v|
|00002410| 61 72 69 61 62 6c 65 73 | 20 61 72 65 20 76 65 72 |ariables| are ver|
|00002420| 79 20 62 61 64 20 66 6f | 72 20 4d 61 63 69 6e 74 |y bad fo|r Macint|
|00002430| 6f 73 68 20 64 65 76 69 | 63 65 20 64 72 69 76 65 |osh devi|ce drive|
|00002440| 72 73 2c 20 74 68 69 73 | 20 67 6c 75 65 20 63 6f |rs, this| glue co|
|00002450| 64 65 20 72 65 6c 69 65 | 73 20 6f 6e 20 61 20 73 |de relie|s on a s|
|00002460| 70 65 63 69 61 6c 20 41 | 2f 55 58 20 74 72 61 70 |pecial A|/UX trap|
|00002470| 20 63 61 6c 6c 65 64 20 | 5f 41 55 58 44 69 73 70 | called |_AUXDisp|
|00002480| 61 74 63 68 20 77 68 69 | 63 68 20 63 61 6e 20 72 |atch whi|ch can r|
|00002490| 65 74 75 72 6e 20 61 20 | 70 6f 69 6e 74 65 72 20 |eturn a |pointer |
|000024a0| 74 6f 20 61 6e 20 41 2f | 55 58 20 65 72 72 6e 6f |to an A/|UX errno|
|000024b0| 20 67 6c 6f 62 61 6c 20 | 76 61 72 69 61 62 6c 65 | global |variable|
|000024c0| 2e 20 20 54 68 65 20 43 | 20 66 75 6e 63 74 69 6f |. The C| functio|
|000024d0| 6e 73 20 53 65 74 41 55 | 58 45 72 72 6e 6f 28 29 |ns SetAU|XErrno()|
|000024e0| 20 61 6e 64 20 47 65 74 | 41 55 58 45 72 72 6e 6f | and Get|AUXErrno|
|000024f0| 28 29 20 61 72 65 20 75 | 73 65 64 20 74 6f 20 73 |() are u|sed to s|
|00002500| 65 74 20 61 6e 64 20 72 | 65 74 72 69 65 76 65 20 |et and r|etrieve |
|00002510| 74 68 69 73 20 76 61 6c | 75 65 2e 20 20 54 68 65 |this val|ue. The|
|00002520| 20 5f 41 55 58 44 69 73 | 70 61 74 63 68 20 74 72 | _AUXDis|patch tr|
|00002530| 61 70 20 69 73 20 64 65 | 66 69 6e 65 64 20 69 6e |ap is de|fined in|
|00002540| 20 61 6e 20 41 2f 55 58 | 20 69 6e 63 6c 75 64 65 | an A/UX| include|
|00002550| 20 66 69 6c 65 20 2f 75 | 73 72 2f 69 6e 63 6c 75 | file /u|sr/inclu|
|00002560| 64 65 2f 6d 61 63 2f 61 | 75 78 2e 68 20 61 6e 64 |de/mac/a|ux.h and|
|00002570| 20 79 6f 75 20 6e 65 65 | 64 20 74 68 69 73 20 66 | you nee|d this f|
|00002580| 69 6c 65 20 74 6f 20 63 | 6f 6d 70 69 6c 65 20 74 |ile to c|ompile t|
|00002590| 68 65 20 43 20 63 6f 64 | 65 2e 20 20 46 6f 72 20 |he C cod|e. For |
|000025a0| 6d 6f 72 65 20 69 6e 66 | 6f 72 6d 61 74 69 6f 6e |more inf|ormation|
|000025b0| 20 61 62 6f 75 74 20 74 | 68 65 20 41 55 58 44 69 | about t|he AUXDi|
|000025c0| 73 70 61 74 63 68 20 74 | 72 61 70 2c 20 63 6f 6e |spatch t|rap, con|
|000025d0| 73 75 6c 74 20 74 68 65 | 20 41 2f 55 58 20 54 6f |sult the| A/UX To|
|000025e0| 6f 6c 62 6f 78 3a 20 4d | 61 63 69 6e 74 6f 73 68 |olbox: M|acintosh|
|000025f0| 20 52 4f 4d 20 49 6e 74 | 65 72 66 61 63 65 20 6d | ROM Int|erface m|
|00002600| 61 6e 75 61 6c 2e 20 4c | 61 73 74 6c 79 2c 20 61 |anual. L|astly, a|
|00002610| 6c 6c 20 66 75 6e 63 74 | 69 6f 6e 20 6e 61 6d 65 |ll funct|ion name|
|00002620| 73 20 68 61 76 65 20 62 | 65 65 6e 20 70 72 65 63 |s have b|een prec|
|00002630| 65 64 65 64 20 62 79 20 | 74 68 65 20 70 72 65 66 |eded by |the pref|
|00002640| 69 78 20 d2 41 55 58 d3 | 20 74 6f 20 64 69 73 74 |ix .AUX.| to dist|
|00002650| 69 6e 67 75 69 73 68 20 | 74 68 65 6d 20 66 72 6f |inguish |them fro|
|00002660| 6d 20 74 68 65 69 72 20 | 4d 50 57 20 43 20 6c 69 |m their |MPW C li|
|00002670| 62 72 61 72 79 20 63 6f | 75 6e 74 65 72 70 61 72 |brary co|unterpar|
|00002680| 74 73 20 28 65 2e 67 2e | 2c 20 74 68 65 20 41 2f |ts (e.g.|, the A/|
|00002690| 55 58 20 72 65 61 64 28 | 29 20 66 75 6e 63 74 69 |UX read(|) functi|
|000026a0| 6f 6e 20 69 73 20 6e 61 | 6d 65 64 20 41 55 58 52 |on is na|med AUXR|
|000026b0| 65 61 64 28 29 20 68 65 | 72 65 29 2e 0d ff 00 9c |ead() he|re).....|
|000026c0| 00 00 0c 00 00 14 00 2c | 0c 00 00 16 00 2e 0c 00 |.......,|........|
|000026d0| 00 14 00 74 0c 00 00 16 | 00 79 0c 00 00 14 00 8e |...t....|.y......|
|000026e0| 0c 00 00 16 00 90 0c 00 | 00 14 01 32 0c 00 00 16 |........|...2....|
|000026f0| 01 3e 0c 00 00 14 01 65 | 0c 00 00 16 01 6a 0c 00 |.>.....e|.....j..|
|00002700| 00 14 01 8d 0c 00 00 16 | 01 9a 0c 00 00 10 01 9b |........|........|
|00002710| 0c 00 00 14 01 9e 0c 00 | 00 10 01 9f 0c 00 00 16 |........|........|
|00002720| 01 ac 0c 00 00 10 01 ad | 0c 00 00 14 01 db 0c 00 |........|........|
|00002730| 00 16 01 e7 0c 00 00 14 | 02 93 0c 02 00 14 02 b8 |........|........|
|00002740| 0c 00 00 14 03 4d 0c 00 | 00 16 03 53 0c 00 00 14 |.....M..|...S....|
|00002750| 03 66 0c 00 00 16 03 6f | 0c 00 00 14 00 01 0d ff |.f.....o|........|
|00002760| 00 06 00 00 0c 00 00 14 | 00 00 01 e6 00 0a 00 00 |........|........|
|00002770| 00 00 00 24 00 48 00 6c | 00 90 00 b4 00 d8 00 fc |...$.H.l|........|
|00002780| 01 20 01 44 01 68 00 00 | 00 00 00 2e 3b 20 20 20 |. .D.h..|....; |
|00002790| 41 55 58 49 4f 2e 61 20 | 2d 2d 20 47 6c 75 65 20 |AUXIO.a |-- Glue |
|000027a0| 66 6f 72 20 41 2f 55 58 | 20 49 2f 4f 20 73 79 73 |for A/UX| I/O sys|
|000027b0| 74 65 6d 20 63 61 6c 6c | 73 0d 00 06 00 00 09 00 |tem call|s.......|
|000027c0| 00 16 00 05 3b 20 20 20 | 0d ff 00 06 00 00 09 00 |....; |........|
|000027d0| 00 16 00 2a 3b 20 20 20 | 43 6f 70 79 72 69 67 68 |...*; |Copyrigh|
|000027e0| 74 20 a9 20 31 39 39 30 | 20 41 70 70 6c 65 20 43 |t . 1990| Apple C|
|000027f0| 6f 6d 70 75 74 65 72 2c | 20 49 6e 63 2e 0d 00 06 |omputer,| Inc....|
|00002800| 00 00 09 00 00 16 00 19 | 3b 20 20 20 41 6c 6c 20 |........|; All |
|00002810| 72 69 67 68 74 73 20 72 | 65 73 65 72 76 65 64 2e |rights r|eserved.|
|00002820| 0d ff 00 06 00 00 09 00 | 00 16 00 05 3b 20 20 20 |........|....; |
|00002830| 0d ff 00 06 00 00 09 00 | 00 16 00 4d 3b 20 20 20 |........|...M; |
|00002840| 54 68 69 73 20 6d 6f 64 | 75 6c 65 20 63 6f 6e 74 |This mod|ule cont|
|00002850| 61 69 6e 73 20 43 20 63 | 61 6c 6c 61 62 6c 65 20 |ains C c|allable |
|00002860| 72 6f 75 74 69 6e 65 73 | 20 74 6f 20 65 78 65 63 |routines| to exec|
|00002870| 75 74 65 20 41 2f 55 58 | 20 73 79 73 74 65 6d 20 |ute A/UX| system |
|00002880| 28 74 72 61 70 20 30 29 | 0d ff 00 06 00 00 09 00 |(trap 0)|........|
|00002890| 00 16 00 4e 3b 20 20 20 | 63 61 6c 6c 73 2e 20 20 |...N; |calls. |
|000028a0| 54 68 65 20 70 61 72 61 | 6d 65 74 65 72 73 20 74 |The para|meters t|
|000028b0| 6f 20 74 68 65 73 65 20 | 72 6f 75 74 69 6e 65 73 |o these |routines|
|000028c0| 20 69 73 20 65 78 61 63 | 74 6c 79 20 61 73 20 74 | is exac|tly as t|
|000028d0| 68 65 79 20 61 72 65 20 | 64 65 73 63 72 69 62 65 |hey are |describe|
|000028e0| 64 0d 00 06 00 00 09 00 | 00 16 00 4c 3b 20 20 20 |d.......|...L; |
|000028f0| 69 6e 20 74 68 65 20 41 | 2f 55 58 20 6d 61 6e 28 |in the A|/UX man(|
|00002900| 32 29 20 64 6f 63 75 6d | 65 6e 74 61 74 69 6f 6e |2) docum|entation|
|00002910| 2e 20 20 54 68 69 73 20 | 6d 65 61 6e 73 20 61 6c |. This |means al|
|00002920| 6c 20 63 68 61 72 20 2a | 20 70 61 72 61 6d 65 74 |l char *| paramet|
|00002930| 65 72 73 20 61 72 65 0d | 00 06 00 00 09 00 00 16 |ers are.|........|
|00002940| 00 4f 3b 20 20 20 4e 55 | 4c 4c 20 74 65 72 6d 69 |.O; NU|LL termi|
|00002950| 6e 61 74 65 64 20 43 20 | 73 74 72 69 6e 67 73 2c |nated C |strings,|
|00002960| 20 6e 6f 74 20 50 61 73 | 63 61 6c 20 73 74 72 69 | not Pas|cal stri|
|00002970| 6e 67 73 2e 20 20 54 68 | 65 79 20 61 6c 6c 20 70 |ngs. Th|ey all p|
|00002980| 72 65 73 75 6d 65 20 74 | 68 61 74 20 41 2f 55 58 |resume t|hat A/UX|
|00002990| 0d 87 00 06 00 00 09 00 | 00 16 00 3e 3b 20 20 20 |........|...>; |
|000029a0| 69 73 20 69 6e 20 66 61 | 63 74 20 72 75 6e 6e 69 |is in fa|ct runni|
|000029b0| 6e 67 2e 20 20 43 65 72 | 74 61 69 6e 20 64 65 61 |ng. Cer|tain dea|
|000029c0| 74 68 20 77 69 6c 6c 20 | 72 65 73 75 6c 74 20 6f |th will |result o|
|000029d0| 74 68 65 72 77 69 73 65 | 2e 0d 00 06 00 00 09 00 |therwise|........|
|000029e0| 00 16 00 01 0d ff 00 06 | 00 00 09 00 00 16 00 24 |........|.......$|
|000029f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 43 41 53 45 | | CASE|
|00002a00| 20 20 20 20 4f 4e 20 20 | 20 20 20 20 3b 20 46 6f | ON | ; Fo|
|00002a10| 72 20 43 0d 00 06 00 00 | 09 00 00 16 00 1f 20 20 |r C.....|...... |
|00002a20| 20 20 20 20 20 20 20 20 | 20 20 49 4e 43 4c 55 44 | | INCLUD|
|00002a30| 45 20 27 53 79 73 45 71 | 75 2e 61 27 0d ff 00 06 |E 'SysEq|u.a'....|
|00002a40| 00 00 09 00 00 16 00 20 | 20 20 20 20 20 20 20 20 |....... | |
|00002a50| 20 20 20 20 49 4d 50 4f | 52 54 20 20 53 65 74 41 | IMPO|RT SetA|
|00002a60| 55 58 45 72 72 6e 6f 0d | 00 06 00 00 09 00 00 16 |UXErrno.|........|
|00002a70| 00 02 3b 0d 00 06 00 00 | 09 00 00 16 00 3f 3b 20 |..;.....|.....?; |
|00002a80| 20 20 48 65 72 65 20 61 | 72 65 20 61 6c 6c 20 74 | Here a|re all t|
|00002a90| 68 65 20 72 6f 75 74 69 | 6e 65 73 20 61 6e 64 20 |he routi|nes and |
|00002aa0| 74 68 65 69 72 20 43 20 | 63 61 6c 6c 69 6e 67 20 |their C |calling |
|00002ab0| 63 6f 6e 76 65 6e 74 69 | 6f 6e 73 3a 0d ff 00 06 |conventi|ons:....|
|00002ac0| 00 00 09 00 00 16 00 2e | 3b 20 20 20 6c 6f 6e 67 |........|; long|
|00002ad0| 20 20 20 20 41 55 58 43 | 72 65 61 74 20 28 63 68 | AUXC|reat (ch|
|00002ae0| 61 72 20 2a 70 61 74 68 | 2c 20 6c 6f 6e 67 20 6d |ar *path|, long m|
|00002af0| 6f 64 65 29 3b 0d 00 06 | 00 00 09 00 00 16 00 21 |ode);...|.......!|
|00002b00| 20 20 20 20 20 20 20 20 | 20 20 20 20 45 58 50 4f | | EXPO|
|00002b10| 52 54 20 20 20 20 20 20 | 41 55 58 43 72 65 61 74 |RT |AUXCreat|
|00002b20| 0d ff 00 06 00 00 09 00 | 00 16 00 39 3b 20 20 20 |........|...9; |
|00002b30| 6c 6f 6e 67 20 20 20 20 | 41 55 58 4f 70 65 6e 20 |long |AUXOpen |
|00002b40| 28 63 68 61 72 20 2a 70 | 61 74 68 2c 20 6c 6f 6e |(char *p|ath, lon|
|00002b50| 67 20 6f 66 6c 61 67 2c | 20 6c 6f 6e 67 20 6d 6f |g oflag,| long mo|
|00002b60| 64 65 29 3b 0d 94 00 06 | 00 00 09 00 00 16 00 20 |de);....|....... |
|00002b70| 20 20 20 20 20 20 20 20 | 20 20 20 20 45 58 50 4f | | EXPO|
|00002b80| 52 54 20 20 20 20 20 20 | 41 55 58 4f 70 65 6e 0d |RT |AUXOpen.|
|00002b90| 00 06 00 00 09 00 00 16 | 00 23 3b 20 20 20 6c 6f |........|.#; lo|
|00002ba0| 6e 67 20 20 20 20 41 55 | 58 43 6c 6f 73 65 20 28 |ng AU|XClose (|
|00002bb0| 69 6e 74 20 66 69 6c 64 | 65 73 29 3b 0d 00 00 06 |int fild|es);....|
|00002bc0| 00 00 09 00 00 16 00 21 | 20 20 20 20 20 20 20 20 |.......!| |
|00002bd0| 20 20 20 20 45 58 50 4f | 52 54 20 20 20 20 20 20 | EXPO|RT |
|00002be0| 41 55 58 43 6c 6f 73 65 | 0d 00 00 06 00 00 09 00 |AUXClose|........|
|00002bf0| 00 16 00 3a 3b 20 20 20 | 6c 6f 6e 67 20 20 20 20 |...:; |long |
|00002c00| 41 55 58 52 65 61 64 20 | 28 6c 6f 6e 67 20 66 69 |AUXRead |(long fi|
|00002c10| 6c 64 65 73 2c 20 63 68 | 61 72 20 2a 62 75 66 2c |ldes, ch|ar *buf,|
|00002c20| 20 6c 6f 6e 67 20 6e 62 | 79 74 65 73 29 0d 00 06 | long nb|ytes)...|
|00002c30| 00 00 09 00 00 16 00 20 | 20 20 20 20 20 20 20 20 |....... | |
|00002c40| 20 20 20 20 45 58 50 4f | 52 54 20 20 20 20 20 20 | EXPO|RT |
|00002c50| 41 55 58 52 65 61 64 0d | 00 06 00 00 09 00 00 16 |AUXRead.|........|
|00002c60| 00 3b 3b 20 20 20 6c 6f | 6e 67 20 20 20 20 41 55 |.;; lo|ng AU|
|00002c70| 58 57 72 69 74 65 20 28 | 6c 6f 6e 67 20 66 69 6c |XWrite (|long fil|
|00002c80| 64 65 73 2c 20 63 68 61 | 72 20 2a 62 75 66 2c 20 |des, cha|r *buf, |
|00002c90| 6c 6f 6e 67 20 6e 62 79 | 74 65 73 29 0d 9a 00 06 |long nby|tes)....|
|00002ca0| 00 00 09 00 00 16 00 21 | 20 20 20 20 20 20 20 20 |.......!| |
|00002cb0| 20 20 20 20 45 58 50 4f | 52 54 20 20 20 20 20 20 | EXPO|RT |
|00002cc0| 41 55 58 57 72 69 74 65 | 0d 00 00 06 00 00 09 00 |AUXWrite|........|
|00002cd0| 00 16 00 3b 3b 20 20 20 | 6c 6f 6e 67 20 20 20 20 |...;; |long |
|00002ce0| 41 55 58 49 6f 63 74 6c | 20 28 6c 6f 6e 67 20 66 |AUXIoctl| (long f|
|00002cf0| 69 6c 64 65 73 2c 20 6c | 6f 6e 67 20 72 65 71 75 |ildes, l|ong requ|
|00002d00| 65 73 74 2c 20 6c 6f 6e | 67 20 61 72 67 29 0d 09 |est, lon|g arg)..|
|00002d10| 00 06 00 00 09 00 00 16 | 00 21 20 20 20 20 20 20 |........|.! |
|00002d20| 20 20 20 20 20 20 45 58 | 50 4f 52 54 20 20 20 20 | EX|PORT |
|00002d30| 20 20 41 55 58 49 6f 63 | 74 6c 0d 01 00 06 00 00 | AUXIoc|tl......|
|00002d40| 09 00 00 16 00 01 0d 96 | 00 06 00 00 09 00 00 16 |........|........|
|00002d50| 00 1c 3b 20 20 20 53 6f | 6d 65 20 6c 6f 63 61 6c |..; So|me local|
|00002d60| 20 65 6e 74 72 79 20 70 | 6f 69 6e 74 73 0d 00 06 | entry p|oints...|
|00002d70| 00 00 09 00 00 16 00 1f | 20 20 20 20 20 20 20 20 |........| |
|00002d80| 20 20 20 20 45 4e 54 52 | 59 20 20 20 20 20 20 20 | ENTR|Y |
|00002d90| 61 75 78 65 72 72 0d 0a | 00 06 00 00 09 00 00 16 |auxerr..|........|
|00002da0| 00 22 20 20 20 20 20 20 | 20 20 20 20 20 20 45 4e |." | EN|
|00002db0| 54 52 59 20 20 20 20 20 | 20 20 61 75 78 63 6f 6d |TRY | auxcom|
|00002dc0| 6d 6f 6e 0d 00 06 00 00 | 09 00 00 16 00 20 20 20 |mon.....|..... |
|00002dd0| 20 20 20 20 20 20 20 20 | 20 20 45 4e 54 52 59 20 | | ENTRY |
|00002de0| 20 20 20 20 20 20 61 75 | 78 65 78 69 74 0d 00 06 | au|xexit...|
|00002df0| 00 00 09 00 00 16 00 01 | 0d 55 00 06 00 00 09 00 |........|.U......|
|00002e00| 00 16 00 11 41 55 58 43 | 72 65 61 74 20 20 20 20 |....AUXC|reat |
|00002e10| 50 52 4f 43 0d 00 00 06 | 00 00 09 00 00 16 00 42 |PROC....|.......B|
|00002e20| 20 20 20 20 20 20 20 20 | 20 20 20 20 6d 6f 76 65 | | move|
|00002e30| 2e 6c 20 20 20 20 20 20 | 23 24 38 2c 44 30 20 20 |.l |#$8,D0 |
|00002e40| 20 20 20 20 20 20 20 20 | 3b 20 63 72 65 61 74 20 | |; creat |
|00002e50| 66 75 6e 63 74 69 6f 6e | 20 73 65 6c 65 63 74 6f |function| selecto|
|00002e60| 72 0d 00 06 00 00 09 00 | 00 16 00 3b 20 20 20 20 |r.......|...; |
|00002e70| 20 20 20 20 20 20 20 20 | 62 72 61 2e 62 20 20 20 | |bra.b |
|00002e80| 20 20 20 20 61 75 78 63 | 6f 6d 6d 6f 6e 20 20 20 | auxc|ommon |
|00002e90| 20 20 20 20 3b 20 4a 6f | 69 6e 20 63 6f 6d 6d 6f | ; Jo|in commo|
|00002ea0| 6e 20 63 6f 64 65 0d b0 | 00 06 00 00 09 00 00 16 |n code..|........|
|00002eb0| 00 1f 41 55 58 4f 70 65 | 6e 20 20 20 20 20 50 52 |..AUXOpe|n PR|
|00002ec0| 4f 43 20 20 20 20 20 20 | 20 20 45 58 50 4f 52 54 |OC | EXPORT|
|00002ed0| 0d 00 00 06 00 00 09 00 | 00 16 00 41 20 20 20 20 |........|...A |
|00002ee0| 20 20 20 20 20 20 20 20 | 6d 6f 76 65 2e 6c 20 20 | |move.l |
|00002ef0| 20 20 20 20 23 24 35 2c | 44 30 20 20 20 20 20 20 | #$5,|D0 |
|00002f00| 20 20 20 20 3b 20 6f 70 | 65 6e 20 66 75 6e 63 74 | ; op|en funct|
|00002f10| 69 6f 6e 20 73 65 6c 65 | 63 74 6f 72 0d ff 00 06 |ion sele|ctor....|
|00002f20| 00 00 09 00 00 16 00 3b | 20 20 20 20 20 20 20 20 |.......;| |
|00002f30| 20 20 20 20 62 72 61 2e | 62 20 20 20 20 20 20 20 | bra.|b |
|00002f40| 61 75 78 63 6f 6d 6d 6f | 6e 20 20 20 20 20 20 20 |auxcommo|n |
|00002f50| 3b 20 4a 6f 69 6e 20 63 | 6f 6d 6d 6f 6e 20 63 6f |; Join c|ommon co|
|00002f60| 64 65 0d ff 00 06 00 00 | 09 00 00 16 00 1f 41 55 |de......|......AU|
|00002f70| 58 43 6c 6f 73 65 20 20 | 20 20 50 52 4f 43 20 20 |XClose | PROC |
|00002f80| 20 20 20 20 20 20 45 58 | 50 4f 52 54 0d 00 00 06 | EX|PORT....|
|00002f90| 00 00 09 00 00 16 00 42 | 20 20 20 20 20 20 20 20 |.......B| |
|00002fa0| 20 20 20 20 6d 6f 76 65 | 2e 6c 20 20 20 20 20 20 | move|.l |
|00002fb0| 23 24 36 2c 44 30 20 20 | 20 20 20 20 20 20 20 20 |#$6,D0 | |
|00002fc0| 3b 20 63 6c 6f 73 65 20 | 66 75 6e 63 74 69 6f 6e |; close |function|
|00002fd0| 20 73 65 6c 65 63 74 6f | 72 0d 00 06 00 00 09 00 | selecto|r.......|
|00002fe0| 00 16 00 3b 20 20 20 20 | 20 20 20 20 20 20 20 20 |...; | |
|00002ff0| 62 72 61 2e 62 20 20 20 | 20 20 20 20 61 75 78 63 |bra.b | auxc|
|00003000| 6f 6d 6d 6f 6e 20 20 20 | 20 20 20 20 3b 20 4a 6f |ommon | ; Jo|
|00003010| 69 6e 20 63 6f 6d 6d 6f | 6e 20 63 6f 64 65 0d fc |in commo|n code..|
|00003020| 00 06 00 00 09 00 00 16 | 00 1f 41 55 58 52 65 61 |........|..AUXRea|
|00003030| 64 20 20 20 20 20 50 52 | 4f 43 20 20 20 20 20 20 |d PR|OC |
|00003040| 20 20 45 58 50 4f 52 54 | 0d ff 00 06 00 00 09 00 | EXPORT|........|
|00003050| 00 16 00 41 20 20 20 20 | 20 20 20 20 20 20 20 20 |...A | |
|00003060| 6d 6f 76 65 2e 6c 20 20 | 20 20 20 20 23 24 33 2c |move.l | #$3,|
|00003070| 44 30 20 20 20 20 20 20 | 20 20 20 20 3b 20 72 65 |D0 | ; re|
|00003080| 61 64 20 66 75 6e 63 74 | 69 6f 6e 20 73 65 6c 65 |ad funct|ion sele|
|00003090| 63 74 6f 72 0d 2a 00 06 | 00 00 09 00 00 16 00 3b |ctor.*..|.......;|
|000030a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 62 72 61 2e | | bra.|
|000030b0| 62 20 20 20 20 20 20 20 | 61 75 78 63 6f 6d 6d 6f |b |auxcommo|
|000030c0| 6e 20 20 20 20 20 20 20 | 3b 20 4a 6f 69 6e 20 63 |n |; Join c|
|000030d0| 6f 6d 6d 6f 6e 20 63 6f | 64 65 0d 4d 00 06 00 00 |ommon co|de.M....|
|000030e0| 09 00 00 16 00 1f 41 55 | 58 57 72 69 74 65 20 20 |......AU|XWrite |
|000030f0| 20 20 50 52 4f 43 20 20 | 20 20 20 20 20 20 45 58 | PROC | EX|
|00003100| 50 4f 52 54 0d 6f 00 06 | 00 00 09 00 00 16 00 42 |PORT.o..|.......B|
|00003110| 20 20 20 20 20 20 20 20 | 20 20 20 20 6d 6f 76 65 | | move|
|00003120| 2e 6c 20 20 20 20 20 20 | 23 24 34 2c 44 30 20 20 |.l |#$4,D0 |
|00003130| 20 20 20 20 20 20 20 20 | 3b 20 77 72 69 74 65 20 | |; write |
|00003140| 66 75 6e 63 74 69 6f 6e | 20 73 65 6c 65 63 74 6f |function| selecto|
|00003150| 72 0d 00 06 00 00 09 00 | 00 16 00 3b 20 20 20 20 |r.......|...; |
|00003160| 20 20 20 20 20 20 20 20 | 62 72 61 2e 62 20 20 20 | |bra.b |
|00003170| 20 20 20 20 61 75 78 63 | 6f 6d 6d 6f 6e 20 20 20 | auxc|ommon |
|00003180| 20 20 20 20 3b 20 4a 6f | 69 6e 20 63 6f 6d 6d 6f | ; Jo|in commo|
|00003190| 6e 20 63 6f 64 65 0d 14 | 00 06 00 00 09 00 00 16 |n code..|........|
|000031a0| 00 1f 41 55 58 49 6f 63 | 74 6c 20 20 20 20 50 52 |..AUXIoc|tl PR|
|000031b0| 4f 43 20 20 20 20 20 20 | 20 20 45 58 50 4f 52 54 |OC | EXPORT|
|000031c0| 0d ff 00 06 00 00 09 00 | 00 16 00 42 20 20 20 20 |........|...B |
|000031d0| 20 20 20 20 20 20 20 20 | 6d 6f 76 65 2e 6c 20 20 | |move.l |
|000031e0| 20 20 20 20 23 24 33 36 | 2c 44 30 20 20 20 20 20 | #$36|,D0 |
|000031f0| 20 20 20 20 3b 20 69 6f | 63 74 6c 20 66 75 6e 63 | ; io|ctl func|
|00003200| 74 69 6f 6e 20 73 65 6c | 65 63 74 6f 72 0d 00 06 |tion sel|ector...|
|00003210| 00 00 09 00 00 16 00 3b | 20 20 20 20 20 20 20 20 |.......;| |
|00003220| 20 20 20 20 62 72 61 2e | 62 20 20 20 20 20 20 20 | bra.|b |
|00003230| 61 75 78 63 6f 6d 6d 6f | 6e 20 20 20 20 20 20 20 |auxcommo|n |
|00003240| 3b 20 4a 6f 69 6e 20 63 | 6f 6d 6d 6f 6e 20 63 6f |; Join c|ommon co|
|00003250| 64 65 0d ff 00 06 00 00 | 09 00 00 16 00 01 0d 0c |de......|........|
|00003260| 00 06 00 00 09 00 00 16 | 00 41 3b 20 20 20 54 72 |........|.A; Tr|
|00003270| 69 76 69 61 20 6f 66 20 | 74 68 65 20 6d 6f 6e 74 |ivia of |the mont|
|00003280| 68 2e 20 20 54 68 65 20 | 66 6c 6f 77 20 6f 66 20 |h. The |flow of |
|00003290| 74 68 65 20 63 6f 64 65 | 20 69 73 20 61 20 6c 69 |the code| is a li|
|000032a0| 74 74 6c 65 20 77 65 69 | 72 64 0d ff 00 06 00 00 |ttle wei|rd......|
|000032b0| 09 00 00 16 00 40 3b 20 | 20 20 68 65 72 65 20 62 |.....@; | here b|
|000032c0| 65 63 61 75 73 65 20 6f | 66 20 61 20 73 74 72 61 |ecause o|f a stra|
|000032d0| 6e 67 65 20 69 6e 74 65 | 72 61 63 74 69 6f 6e 20 |nge inte|raction |
|000032e0| 62 65 74 77 65 65 6e 20 | 74 68 65 20 61 73 73 65 |between |the asse|
|000032f0| 6d 62 6c 65 72 0d 00 06 | 00 00 09 00 00 16 00 43 |mbler...|.......C|
|00003300| 3b 20 20 20 61 6e 64 20 | 74 68 65 20 6c 69 6e 6b |; and |the link|
|00003310| 65 72 2e 20 20 4c 6f 67 | 69 63 61 6c 6c 79 2c 20 |er. Log|ically, |
|00003320| 61 75 78 63 6f 6d 6d 6f | 6e 20 73 68 6f 75 6c 64 |auxcommo|n should|
|00003330| 20 67 6f 20 68 65 72 65 | 2c 20 62 75 74 20 77 68 | go here|, but wh|
|00003340| 61 74 0d ff 00 06 00 00 | 09 00 00 16 00 42 3b 20 |at......|.....B; |
|00003350| 20 20 68 61 70 70 65 6e | 73 20 69 6e 20 74 68 61 | happen|s in tha|
|00003360| 74 20 63 61 73 65 20 69 | 73 20 74 68 65 20 61 73 |t case i|s the as|
|00003370| 73 65 6d 62 6c 65 72 20 | 67 65 6e 65 72 61 74 65 |sembler |generate|
|00003380| 73 20 61 20 62 79 74 65 | 20 62 72 61 6e 63 68 0d |s a byte| branch.|
|00003390| 00 06 00 00 09 00 00 16 | 00 42 3b 20 20 20 69 6e |........|.B; in|
|000033a0| 73 74 72 75 63 74 69 6f | 6e 20 66 6f 72 20 74 68 |structio|n for th|
|000033b0| 65 20 70 72 65 76 69 6f | 75 73 20 69 6e 73 74 72 |e previo|us instr|
|000033c0| 75 63 74 69 6f 6e 2c 20 | 62 75 74 20 74 68 65 6e |uction, |but then|
|000033d0| 20 74 68 65 20 6c 69 6e | 6b 65 72 0d 00 06 00 00 | the lin|ker.....|
|000033e0| 09 00 00 16 00 41 3b 20 | 20 20 63 68 65 65 72 66 |.....A; | cheerf|
|000033f0| 75 6c 6c 79 20 66 69 6c | 6c 73 20 69 6e 20 74 68 |ully fil|ls in th|
|00003400| 65 20 62 79 74 65 20 6f | 66 66 73 65 74 2c 20 77 |e byte o|ffset, w|
|00003410| 68 69 63 68 20 69 66 20 | 61 75 78 63 6f 6d 6d 6f |hich if |auxcommo|
|00003420| 6e 20 77 65 72 65 0d ff | 00 06 00 00 09 00 00 16 |n were..|........|
|00003430| 00 41 3b 20 20 20 74 68 | 65 20 6e 65 78 74 20 69 |.A; th|e next i|
|00003440| 6e 73 74 72 75 63 74 69 | 6f 6e 20 77 6f 75 6c 64 |nstructi|on would|
|00003450| 20 62 65 20 7a 65 72 6f | 2e 20 20 41 74 20 72 75 | be zero|. At ru|
|00003460| 6e 74 69 6d 65 2c 20 74 | 68 69 73 20 63 61 75 73 |ntime, t|his caus|
|00003470| 65 73 0d ff 00 06 00 00 | 09 00 00 16 00 43 3b 20 |es......|.....C; |
|00003480| 20 20 74 68 65 20 62 72 | 61 2e 62 20 74 6f 20 67 | the br|a.b to g|
|00003490| 65 74 20 69 6e 74 65 72 | 70 72 65 74 65 64 20 61 |et inter|preted a|
|000034a0| 73 20 61 20 62 72 61 2e | 77 20 61 6e 64 20 6f 66 |s a bra.|w and of|
|000034b0| 20 63 6f 75 72 73 65 20 | 74 68 65 20 63 6f 64 65 | course |the code|
|000034c0| 0d ff 00 06 00 00 09 00 | 00 16 00 45 3b 20 20 20 |........|...E; |
|000034d0| 66 6c 69 65 73 20 6f 66 | 66 20 69 6e 74 6f 20 6e |flies of|f into n|
|000034e0| 65 76 65 72 2d 6e 65 76 | 65 72 20 6c 61 6e 64 2e |ever-nev|er land.|
|000034f0| 20 20 53 6f 20 77 65 20 | 73 74 69 63 6b 20 69 6e | So we |stick in|
|00003500| 20 73 6f 6d 65 20 63 6f | 6e 76 65 6e 69 65 6e 74 | some co|nvenient|
|00003510| 0d ff 00 06 00 00 09 00 | 00 16 00 39 3b 20 20 20 |........|...9; |
|00003520| 69 6e 74 65 72 76 65 6e | 69 6e 67 20 63 6f 64 65 |interven|ing code|
|00003530| 20 74 6f 20 65 6e 73 75 | 72 65 20 74 68 65 20 6f | to ensu|re the o|
|00003540| 66 66 73 65 74 20 69 73 | 20 6e 65 76 65 72 20 7a |ffset is| never z|
|00003550| 65 72 6f 2e 0d ff 00 06 | 00 00 09 00 00 16 00 1e |ero.....|........|
|00003560| 61 75 78 65 72 72 20 20 | 20 20 20 20 50 52 4f 43 |auxerr | PROC|
|00003570| 20 20 20 20 20 20 20 20 | 45 4e 54 52 59 0d 00 06 | |ENTRY...|
|00003580| 00 00 09 00 00 16 00 3a | 20 20 20 20 20 20 20 20 |.......:| |
|00003590| 20 20 20 20 6d 6f 76 65 | 2e 6c 20 20 20 20 20 20 | move|.l |
|000035a0| 44 30 2c 2d 28 53 50 29 | 20 20 20 20 20 20 20 20 |D0,-(SP)| |
|000035b0| 3b 20 50 75 73 68 20 65 | 72 72 6f 72 20 63 6f 64 |; Push e|rror cod|
|000035c0| 65 0d 00 06 00 00 09 00 | 00 16 00 34 20 20 20 20 |e.......|...4 |
|000035d0| 20 20 20 20 20 20 20 20 | 6a 73 72 20 20 20 20 20 | |jsr |
|000035e0| 20 20 20 20 53 65 74 41 | 55 58 45 72 72 6e 6f 20 | SetA|UXErrno |
|000035f0| 20 20 20 20 3b 20 53 65 | 74 20 65 72 72 6e 6f 0d | ; Se|t errno.|
|00003600| 00 06 00 00 09 00 00 16 | 00 3b 20 20 20 20 20 20 |........|.; |
|00003610| 20 20 20 20 20 20 61 64 | 64 2e 77 20 20 20 20 20 | ad|d.w |
|00003620| 20 20 23 24 34 2c 53 50 | 20 20 20 20 20 20 20 20 | #$4,SP| |
|00003630| 20 20 3b 20 52 65 6d 6f | 76 65 20 70 61 72 61 6d | ; Remo|ve param|
|00003640| 65 74 65 72 0d ff 00 06 | 00 00 09 00 00 16 00 42 |eter....|.......B|
|00003650| 20 20 20 20 20 20 20 20 | 20 20 20 20 6d 6f 76 65 | | move|
|00003660| 2e 6c 20 20 20 20 20 20 | 23 24 46 46 46 46 46 46 |.l |#$FFFFFF|
|00003670| 46 46 2c 44 30 20 20 20 | 3b 20 53 65 74 20 2d 31 |FF,D0 |; Set -1|
|00003680| 20 66 6f 72 20 72 65 74 | 75 72 6e 20 76 61 6c 75 | for ret|urn valu|
|00003690| 65 0d 00 06 00 00 09 00 | 00 16 00 35 20 20 20 20 |e.......|...5 |
|000036a0| 20 20 20 20 20 20 20 20 | 62 72 61 2e 62 20 20 20 | |bra.b |
|000036b0| 20 20 20 20 61 75 78 65 | 78 69 74 20 20 20 20 20 | auxe|xit |
|000036c0| 20 20 20 20 3b 20 4f 75 | 74 74 61 20 68 65 72 65 | ; Ou|tta here|
|000036d0| 0d ff 00 06 00 00 09 00 | 00 16 00 01 0d ff 00 06 |........|........|
|000036e0| 00 00 09 00 00 16 00 1e | 61 75 78 63 6f 6d 6d 6f |........|auxcommo|
|000036f0| 6e 20 20 20 50 52 4f 43 | 20 20 20 20 20 20 20 20 |n PROC| |
|00003700| 45 4e 54 52 59 0d 00 06 | 00 00 09 00 00 16 00 31 |ENTRY...|.......1|
|00003710| 20 20 20 20 20 20 20 20 | 20 20 20 20 74 72 61 70 | | trap|
|00003720| 20 20 20 20 20 20 20 20 | 23 24 30 20 20 20 20 20 | |#$0 |
|00003730| 20 20 20 20 20 20 20 20 | 3b 20 74 72 61 70 20 30 | |; trap 0|
|00003740| 0d ff 00 06 00 00 09 00 | 00 16 00 37 20 20 20 20 |........|...7 |
|00003750| 20 20 20 20 20 20 20 20 | 62 63 63 2e 62 20 20 20 | |bcc.b |
|00003760| 20 20 20 20 61 75 78 65 | 78 69 74 20 20 20 20 20 | auxe|xit |
|00003770| 20 20 20 20 3b 20 43 43 | 2c 20 6e 6f 20 65 72 72 | ; CC|, no err|
|00003780| 6f 72 0d ff 00 06 00 00 | 09 00 00 16 00 43 20 20 |or......|.....C |
|00003790| 20 20 20 20 20 20 20 20 | 20 20 62 72 61 2e 62 20 | | bra.b |
|000037a0| 20 20 20 20 20 20 61 75 | 78 65 72 72 20 20 20 20 | au|xerr |
|000037b0| 20 20 20 20 20 20 3b 20 | 44 6f 20 63 6f 6d 6d 6f | ; |Do commo|
|000037c0| 6e 20 65 72 72 6f 72 20 | 68 61 6e 64 6c 69 6e 67 |n error |handling|
|000037d0| 0d 20 00 06 00 00 09 00 | 00 16 00 01 0d 00 00 06 |. ......|........|
|000037e0| 00 00 09 00 00 16 00 1e | 61 75 78 65 78 69 74 20 |........|auxexit |
|000037f0| 20 20 20 20 50 52 4f 43 | 20 20 20 20 20 20 20 20 | PROC| |
|00003800| 45 4e 54 52 59 0d 00 06 | 00 00 09 00 00 16 00 10 |ENTRY...|........|
|00003810| 20 20 20 20 20 20 20 20 | 20 20 20 20 72 74 73 0d | | rts.|
|00003820| 00 06 00 00 09 00 00 16 | 00 14 20 20 20 20 20 20 |........|.. |
|00003830| 20 20 20 20 20 20 45 4e | 44 50 52 4f 43 0d 00 06 | EN|DPROC...|
|00003840| 00 00 09 00 00 16 00 01 | 0d 00 00 06 00 00 09 00 |........|........|
|00003850| 00 16 00 10 20 20 20 20 | 20 20 20 20 20 20 20 20 |.... | |
|00003860| 45 4e 44 0d 00 06 00 00 | 09 00 00 16 00 00 01 e6 |END.....|........|
|00003870| 03 0a 00 00 00 00 00 24 | 00 48 00 6c 00 90 00 b4 |.......$|.H.l....|
|00003880| 00 d8 00 fc 01 20 01 44 | 01 68 00 00 00 00 00 01 |..... .D|.h......|
|00003890| 0d 00 00 06 00 00 0c 00 | 00 14 01 d4 54 68 65 20 |........|....The |
|000038a0| 73 65 63 6f 6e 64 20 61 | 72 67 75 6d 65 6e 74 20 |second a|rgument |
|000038b0| 74 6f 20 74 68 65 20 41 | 55 58 49 6f 63 74 6c 20 |to the A|UXIoctl |
|000038c0| 63 61 6c 6c 20 6e 65 65 | 64 73 20 73 6f 6d 65 20 |call nee|ds some |
|000038d0| 73 70 65 63 69 61 6c 20 | 61 74 74 65 6e 74 69 6f |special |attentio|
|000038e0| 6e 2e 20 20 54 68 65 20 | 41 2f 55 58 20 68 65 61 |n. The |A/UX hea|
|000038f0| 64 65 72 20 66 69 6c 65 | 20 2f 75 73 72 2f 69 6e |der file| /usr/in|
|00003900| 63 6c 75 64 65 2f 73 79 | 73 2f 69 6f 63 74 6c 2e |clude/sy|s/ioctl.|
|00003910| 68 20 64 65 73 63 72 69 | 62 65 73 20 74 68 65 20 |h descri|bes the |
|00003920| 66 6f 72 6d 61 74 20 6f | 66 20 72 65 71 75 65 73 |format o|f reques|
|00003930| 74 2e 20 20 54 68 65 73 | 65 20 66 6f 75 72 20 62 |t. Thes|e four b|
|00003940| 79 74 65 73 20 68 6f 6c | 64 20 73 65 76 65 72 61 |ytes hol|d severa|
|00003950| 6c 20 66 69 65 6c 64 73 | 20 64 65 73 63 72 69 62 |l fields| describ|
|00003960| 69 6e 67 20 74 68 65 20 | 64 61 74 61 20 66 6f 72 |ing the |data for|
|00003970| 6d 61 74 2e 20 20 4e 6f | 72 6d 61 6c 6c 79 2c 20 |mat. No|rmally, |
|00003980| 6d 61 63 72 6f 73 20 64 | 65 66 69 6e 65 64 20 69 |macros d|efined i|
|00003990| 6e 20 74 68 65 20 69 6f | 63 74 6c 2e 68 20 68 65 |n the io|ctl.h he|
|000039a0| 61 64 65 72 20 66 69 6c | 65 20 74 61 6b 65 20 63 |ader fil|e take c|
|000039b0| 61 72 65 20 6f 66 20 70 | 61 63 6b 69 6e 67 20 74 |are of p|acking t|
|000039c0| 68 65 73 65 20 66 69 65 | 6c 64 73 2e 20 20 4d 61 |hese fie|lds. Ma|
|000039d0| 6b 65 20 73 75 72 65 20 | 79 6f 75 20 75 73 65 20 |ke sure |you use |
|000039e0| 74 68 65 20 73 61 6d 65 | 20 66 6f 72 6d 61 74 20 |the same| format |
|000039f0| 77 68 65 6e 20 79 6f 75 | 20 63 6f 6e 73 74 72 75 |when you| constru|
|00003a00| 63 74 20 79 6f 75 72 20 | 72 65 71 75 65 73 74 20 |ct your |request |
|00003a10| 61 72 67 75 6d 65 6e 74 | 2e 20 20 4a 75 73 74 20 |argument|. Just |
|00003a20| 75 73 65 20 74 68 65 20 | 65 78 61 6d 70 6c 65 20 |use the |example |
|00003a30| 63 6f 6d 6d 61 6e 64 73 | 20 69 6e 20 74 68 65 20 |commands| in the |
|00003a40| 2f 75 73 72 2f 69 6e 63 | 6c 75 64 65 2f 73 79 73 |/usr/inc|lude/sys|
|00003a50| 2f 2a 69 6f 63 74 6c 2e | 68 20 66 69 6c 65 73 20 |/*ioctl.|h files |
|00003a60| 61 73 20 61 20 72 65 66 | 65 72 65 6e 63 65 2e 0d |as a ref|erence..|
|00003a70| 00 2a 00 00 0c 00 00 14 | 00 1b 0c 00 00 16 00 23 |.*......|.......#|
|00003a80| 0c 00 00 14 00 8e 0c 00 | 00 16 00 95 0c 00 00 14 |........|........|
|00003a90| 01 6c 0c 00 00 16 01 73 | 0c 00 00 14 00 01 0d 08 |.l.....s|........|
|00003aa0| 00 06 00 00 0c 00 00 14 | 00 56 46 6f 6c 6c 6f 77 |........|.VFollow|
|00003ab0| 69 6e 67 20 61 72 65 20 | 74 68 65 20 43 20 66 75 |ing are |the C fu|
|00003ac0| 6e 63 74 69 6f 6e 73 20 | 74 6f 20 70 72 6f 70 65 |nctions |to prope|
|00003ad0| 72 6c 79 20 67 65 74 20 | 61 6e 64 20 73 65 74 20 |rly get |and set |
|00003ae0| 74 68 65 20 41 2f 55 58 | 20 65 72 72 6e 6f 20 67 |the A/UX| errno g|
|00003af0| 6c 6f 62 61 6c 20 76 61 | 72 69 61 62 6c 65 3a 0d |lobal va|riable:.|
|00003b00| 00 12 00 00 0c 00 00 14 | 00 3f 0c 00 00 16 00 44 |........|.?.....D|
|00003b10| 0c 00 00 14 00 01 0d 00 | 00 06 00 00 0c 00 00 14 |........|........|
|00003b20| 00 00 01 e6 00 0a 00 00 | 00 00 00 24 00 48 00 6c |........|...$.H.l|
|00003b30| 00 90 00 b4 00 d8 00 fc | 01 20 01 44 01 68 00 00 |........|. .D.h..|
|00003b40| 00 00 00 03 2f 2a 0d 00 | 00 06 00 00 09 00 00 16 |..../*..|........|
|00003b50| 00 11 20 2a 20 20 20 20 | 41 55 58 45 72 72 6e 6f |.. * |AUXErrno|
|00003b60| 2e 63 0d 00 00 06 00 00 | 09 00 00 16 00 03 20 2a |.c......|...... *|
|00003b70| 0d 01 00 06 00 00 09 00 | 00 16 00 2c 20 2a 20 20 |........|..., * |
|00003b80| 20 20 43 6f 70 79 72 69 | 67 68 74 20 a9 20 31 39 | Copyri|ght . 19|
|00003b90| 39 30 20 41 70 70 6c 65 | 20 43 6f 6d 70 75 74 65 |90 Apple| Compute|
|00003ba0| 72 2c 20 49 6e 63 2e 0d | 00 06 00 00 09 00 00 16 |r, Inc..|........|
|00003bb0| 00 1b 20 2a 20 20 20 20 | 41 6c 6c 20 72 69 67 68 |.. * |All righ|
|00003bc0| 74 73 20 72 65 73 65 72 | 76 65 64 2e 0d ff 00 06 |ts reser|ved.....|
|00003bd0| 00 00 09 00 00 16 00 03 | 20 2a 0d ff 00 06 00 00 |........| *......|
|00003be0| 09 00 00 16 00 53 20 2a | 20 20 20 20 54 68 69 73 |.....S *| This|
|00003bf0| 20 66 69 6c 65 20 63 6f | 6e 74 61 69 6e 73 20 72 | file co|ntains r|
|00003c00| 6f 75 74 69 6e 65 73 20 | 74 6f 20 70 72 6f 70 65 |outines |to prope|
|00003c10| 72 6c 79 20 67 65 74 20 | 61 6e 64 20 73 65 74 20 |rly get |and set |
|00003c20| 74 68 65 20 73 74 61 6e | 64 61 72 64 20 55 6e 69 |the stan|dard Uni|
|00003c30| 78 20 67 6c 6f 62 61 6c | 0d 00 00 06 00 00 09 00 |x global|........|
|00003c40| 00 16 00 50 20 2a 20 20 | 20 20 65 72 72 6e 6f 20 |...P * | errno |
|00003c50| 66 72 6f 6d 20 77 69 74 | 68 69 6e 20 61 6e 20 4d |from wit|hin an M|
|00003c60| 61 63 69 6e 74 6f 73 68 | 20 61 70 70 6c 69 63 61 |acintosh| applica|
|00003c70| 74 69 6f 6e 2e 20 20 49 | 74 20 75 73 65 73 20 74 |tion. I|t uses t|
|00003c80| 68 65 20 41 55 58 44 69 | 73 70 61 74 63 68 20 74 |he AUXDi|spatch t|
|00003c90| 72 61 70 0d 00 06 00 00 | 09 00 00 16 00 31 20 2a |rap.....|.....1 *|
|00003ca0| 20 20 20 20 74 6f 20 67 | 65 74 20 61 20 70 6f 69 | to g|et a poi|
|00003cb0| 6e 74 65 72 20 74 6f 20 | 74 68 65 20 61 64 64 72 |nter to |the addr|
|00003cc0| 65 73 73 20 74 6f 20 62 | 65 20 73 65 74 2e 0d 00 |ess to b|e set...|
|00003cd0| 00 06 00 00 09 00 00 16 | 00 04 20 2a 2f 0d 00 06 |........|.. */...|
|00003ce0| 00 00 09 00 00 16 00 11 | 23 69 6e 63 6c 75 64 65 |........|#include|
|00003cf0| 20 3c 61 75 78 2e 68 3e | 0d 0b 00 06 00 00 09 00 | <aux.h>|........|
|00003d00| 00 16 00 01 0d 11 00 06 | 00 00 09 00 00 16 00 17 |........|........|
|00003d10| 76 6f 69 64 20 53 65 74 | 41 55 58 45 72 72 6e 6f |void Set|AUXErrno|
|00003d20| 20 28 65 72 72 29 0d 6e | 00 06 00 00 09 00 00 16 | (err).n|........|
|00003d30| 00 0a 6c 6f 6e 67 20 65 | 72 72 3b 0d 00 06 00 00 |..long e|rr;.....|
|00003d40| 09 00 00 16 00 02 7b 0d | 00 06 00 00 09 00 00 16 |......{.|........|
|00003d50| 00 17 20 20 20 20 6c 6f | 6e 67 20 20 20 20 2a 65 |.. lo|ng *e|
|00003d60| 72 72 6e 6f 70 74 72 3b | 0d 74 00 06 00 00 09 00 |rrnoptr;|.t......|
|00003d70| 00 16 00 01 0d 72 00 06 | 00 00 09 00 00 16 00 1b |.....r..|........|
|00003d80| 20 20 20 20 69 66 20 28 | 21 67 65 74 41 55 58 56 | if (|!getAUXV|
|00003d90| 65 72 73 69 6f 6e 20 28 | 29 29 0d 64 00 06 00 00 |ersion (|)).d....|
|00003da0| 09 00 00 16 00 39 20 20 | 20 20 20 20 20 20 72 65 |.....9 | re|
|00003db0| 74 75 72 6e 3b 20 20 20 | 20 20 20 20 20 20 20 20 |turn; | |
|00003dc0| 20 20 20 20 20 2f 2a 20 | 4e 6f 20 41 2f 55 58 2c | /* |No A/UX,|
|00003dd0| 20 64 6f 20 6e 6f 74 68 | 69 6e 67 20 2a 2f 0d 20 | do noth|ing */. |
|00003de0| 00 06 00 00 09 00 00 16 | 00 01 0d ff 00 06 00 00 |........|........|
|00003df0| 09 00 00 16 00 12 20 20 | 20 20 65 72 72 6e 6f 70 |...... | errnop|
|00003e00| 74 72 20 3d 20 30 3b 0d | 00 06 00 00 09 00 00 16 |tr = 0;.|........|
|00003e10| 00 35 20 20 20 20 41 55 | 58 44 69 73 70 61 74 63 |.5 AU|XDispatc|
|00003e20| 68 20 28 41 55 58 5f 47 | 45 54 5f 45 52 52 4e 4f |h (AUX_G|ET_ERRNO|
|00003e30| 2c 20 28 63 68 61 72 20 | 2a 29 20 26 65 72 72 6e |, (char |*) &errn|
|00003e40| 6f 70 74 72 29 3b 0d 00 | 00 06 00 00 09 00 00 16 |optr);..|........|
|00003e50| 00 08 20 20 20 20 2f 2a | 20 0d 00 06 00 00 09 00 |.. /*| .......|
|00003e60| 00 16 00 42 20 20 20 20 | 20 2a 20 49 66 20 65 72 |...B | * If er|
|00003e70| 72 6e 6f 70 74 72 20 69 | 73 20 73 74 69 6c 6c 20 |rnoptr i|s still |
|00003e80| 4e 49 4c 2c 20 41 55 58 | 44 69 73 70 61 74 63 68 |NIL, AUX|Dispatch|
|00003e90| 20 66 61 69 6c 65 64 20 | 73 6f 20 64 6f 20 6e 6f | failed |so do no|
|00003ea0| 74 68 69 6e 67 0d 00 06 | 00 00 09 00 00 16 00 08 |thing...|........|
|00003eb0| 20 20 20 20 20 2a 2f 0d | 00 06 00 00 09 00 00 16 | */.|........|
|00003ec0| 00 12 20 20 20 20 69 66 | 20 28 65 72 72 6e 6f 70 |.. if| (errnop|
|00003ed0| 74 72 29 0d 00 06 00 00 | 09 00 00 16 00 19 20 20 |tr).....|...... |
|00003ee0| 20 20 20 20 20 20 2a 65 | 72 72 6e 6f 70 74 72 20 | *e|rrnoptr |
|00003ef0| 3d 20 65 72 72 3b 0d ff | 00 06 00 00 09 00 00 16 |= err;..|........|
|00003f00| 00 0c 20 20 20 20 72 65 | 74 75 72 6e 3b 0d 00 06 |.. re|turn;...|
|00003f10| 00 00 09 00 00 16 00 02 | 7d 0d 00 06 00 00 09 00 |........|}.......|
|00003f20| 00 16 00 01 0d ff 00 06 | 00 00 09 00 00 16 00 14 |........|........|
|00003f30| 6c 6f 6e 67 20 47 65 74 | 41 55 58 45 72 72 6e 6f |long Get|AUXErrno|
|00003f40| 20 28 29 0d 00 06 00 00 | 09 00 00 16 00 02 7b 0d | ().....|......{.|
|00003f50| 00 06 00 00 09 00 00 16 | 00 17 20 20 20 20 6c 6f |........|.. lo|
|00003f60| 6e 67 20 20 20 20 2a 65 | 72 72 6e 6f 70 74 72 3b |ng *e|rrnoptr;|
|00003f70| 0d ff 00 06 00 00 09 00 | 00 16 00 05 20 20 20 20 |........|.... |
|00003f80| 0d ff 00 06 00 00 09 00 | 00 16 00 1b 20 20 20 20 |........|.... |
|00003f90| 69 66 20 28 21 67 65 74 | 41 55 58 56 65 72 73 69 |if (!get|AUXVersi|
|00003fa0| 6f 6e 20 28 29 29 0d 07 | 00 06 00 00 09 00 00 16 |on ())..|........|
|00003fb0| 00 3d 20 20 20 20 20 20 | 20 20 72 65 74 75 72 6e |.= | return|
|00003fc0| 20 28 30 29 3b 20 20 20 | 20 20 20 20 20 20 20 20 | (0); | |
|00003fd0| 20 2f 2a 20 4e 6f 20 41 | 2f 55 58 2c 20 72 65 74 | /* No A|/UX, ret|
|00003fe0| 75 72 6e 20 6e 6f 65 72 | 72 6f 72 20 2a 2f 0d ff |urn noer|ror */..|
|00003ff0| 00 06 00 00 09 00 00 16 | 00 12 20 20 20 20 65 72 |........|.. er|
|00004000| 72 6e 6f 70 74 72 20 3d | 20 30 3b 0d 00 06 00 00 |rnoptr =| 0;.....|
|00004010| 09 00 00 16 00 35 20 20 | 20 20 41 55 58 44 69 73 |.....5 | AUXDis|
|00004020| 70 61 74 63 68 20 28 41 | 55 58 5f 47 45 54 5f 45 |patch (A|UX_GET_E|
|00004030| 52 52 4e 4f 2c 20 28 63 | 68 61 72 20 2a 29 20 26 |RRNO, (c|har *) &|
|00004040| 65 72 72 6e 6f 70 74 72 | 29 3b 0d 1e 00 06 00 00 |errnoptr|);......|
|00004050| 09 00 00 16 00 08 20 20 | 20 20 2f 2a 20 0d 00 06 |...... | /* ...|
|00004060| 00 00 09 00 00 16 00 4d | 20 20 20 20 20 2a 20 49 |.......M| * I|
|00004070| 66 20 65 72 72 6e 6f 70 | 74 72 20 69 73 20 73 74 |f errnop|tr is st|
|00004080| 69 6c 6c 20 4e 49 4c 2c | 20 77 65 27 72 65 20 6e |ill NIL,| we're n|
|00004090| 6f 74 20 75 6e 64 65 72 | 20 41 2f 55 58 2c 20 6f |ot under| A/UX, o|
|000040a0| 72 20 41 55 58 44 69 73 | 70 61 74 63 68 20 66 61 |r AUXDis|patch fa|
|000040b0| 69 6c 65 64 0d ff 00 06 | 00 00 09 00 00 16 00 15 |iled....|........|
|000040c0| 20 20 20 20 20 2a 20 73 | 6f 20 64 6f 20 6e 6f 74 | * s|o do not|
|000040d0| 68 69 6e 67 0d ff 00 06 | 00 00 09 00 00 16 00 08 |hing....|........|
|000040e0| 20 20 20 20 20 2a 2f 0d | 00 06 00 00 09 00 00 16 | */.|........|
|000040f0| 00 12 20 20 20 20 69 66 | 20 28 65 72 72 6e 6f 70 |.. if| (errnop|
|00004100| 74 72 29 0d 00 06 00 00 | 09 00 00 16 00 1c 20 20 |tr).....|...... |
|00004110| 20 20 20 20 20 20 72 65 | 74 75 72 6e 20 28 2a 65 | re|turn (*e|
|00004120| 72 72 6e 6f 70 74 72 29 | 3b 0d 00 06 00 00 09 00 |rrnoptr)|;.......|
|00004130| 00 16 00 09 20 20 20 20 | 65 6c 73 65 0d ff 00 06 |.... |else....|
|00004140| 00 00 09 00 00 16 00 14 | 20 20 20 20 20 20 20 20 |........| |
|00004150| 72 65 74 75 72 6e 20 28 | 30 29 3b 0d 00 06 00 00 |return (|0);.....|
|00004160| 09 00 00 16 00 02 7d 0d | 00 06 00 00 09 00 00 16 |......}.|........|
|00004170| 00 00 01 e6 03 0a 00 00 | 00 00 00 24 00 48 00 6c |........|...$.H.l|
|00004180| 00 90 00 b4 00 d8 00 fc | 01 20 01 44 01 68 00 00 |........|. .D.h..|
|00004190| 00 00 00 01 0d ff 00 06 | 00 00 0c 00 00 14 00 01 |........|........|
|000041a0| 0d ff 00 06 00 00 0c 00 | 00 14 00 00 01 e6 03 0a |........|........|
|000041b0| 00 00 00 00 00 24 00 48 | 00 6c 00 90 00 b4 00 d8 |.....$.H|.l......|
|000041c0| 00 fc 01 20 01 44 01 68 | 00 00 00 00 00 01 0d 20 |... .D.h|....... |
|000041d0| 00 06 00 00 0c 00 00 14 | 47 49 43 50 49 43 11 01 |........|GICPIC..|
|000041e0| ff 96 00 47 55 73 65 20 | 6f 66 20 74 68 65 20 66 |...GUse |of the f|
|000041f0| 6f 72 6b 28 29 20 63 61 | 6c 6c 20 75 6e 64 65 72 |ork() ca|ll under|
|00004200| 20 41 2f 55 58 20 4d 75 | 6c 74 69 46 69 6e 64 65 | A/UX Mu|ltiFinde|
|00004210| 72 20 65 6d 75 6c 61 74 | 69 6f 6e 20 20 20 20 20 |r emulat|ion |
|00004220| 20 20 20 20 20 20 20 20 | 20 20 0d ff 00 0c 00 00 | | ......|
|00004230| 0e 01 00 14 00 3a 0c 00 | 00 14 00 01 0d ff 00 06 |.....:..|........|
|00004240| 00 00 0c 00 00 14 03 26 | 54 68 65 20 66 6f 6c 6c |.......&|The foll|
|00004250| 6f 77 69 6e 67 20 61 64 | 76 69 63 65 20 63 6f 6e |owing ad|vice con|
|00004260| 63 65 72 6e 73 20 74 68 | 65 20 75 73 65 20 6f 66 |cerns th|e use of|
|00004270| 20 74 68 65 20 41 2f 55 | 58 20 66 6f 72 6b 28 29 | the A/U|X fork()|
|00004280| 20 73 79 73 74 65 6d 20 | 63 61 6c 6c 20 75 6e 64 | system |call und|
|00004290| 65 72 20 74 68 65 20 4d | 75 6c 74 69 46 69 6e 64 |er the M|ultiFind|
|000042a0| 65 72 20 65 6d 75 6c 61 | 74 69 6f 6e 20 6d 6f 64 |er emula|tion mod|
|000042b0| 65 2e 20 55 6e 64 65 72 | 20 41 2f 55 58 20 74 68 |e. Under| A/UX th|
|000042c0| 65 20 6b 65 72 6e 65 6c | 20 64 6f 65 73 20 6e 6f |e kernel| does no|
|000042d0| 74 20 73 65 70 61 72 61 | 74 65 20 74 68 65 20 64 |t separa|te the d|
|000042e0| 61 74 61 20 72 65 67 69 | 6f 6e 20 6f 66 20 74 68 |ata regi|on of th|
|000042f0| 65 20 70 61 72 65 6e 74 | 20 70 72 6f 63 65 73 73 |e parent| process|
|00004300| 20 66 6f 72 20 74 68 65 | 20 63 68 69 6c 64 20 61 | for the| child a|
|00004310| 66 74 65 72 20 61 20 66 | 6f 72 6b 28 29 20 63 61 |fter a f|ork() ca|
|00004320| 6c 6c 2e 20 49 66 20 77 | 65 20 64 6f 20 61 20 73 |ll. If w|e do a s|
|00004330| 69 6d 70 6c 65 20 66 6f | 72 6b 20 77 65 20 68 61 |imple fo|rk we ha|
|00004340| 76 65 20 73 75 64 64 65 | 6e 6c 79 20 74 77 6f 20 |ve sudde|nly two |
|00004350| 4d 75 6c 74 69 46 69 6e | 64 65 72 20 70 72 6f 63 |MultiFin|der proc|
|00004360| 65 73 73 65 73 20 72 75 | 6e 6e 69 6e 67 2c 20 61 |esses ru|nning, a|
|00004370| 6e 64 20 74 68 65 79 20 | 62 6f 74 68 20 77 69 6c |nd they |both wil|
|00004380| 6c 20 73 68 61 72 65 20 | 74 68 65 20 73 61 6d 65 |l share |the same|
|00004390| 20 72 65 73 6f 75 72 63 | 65 73 2e 20 54 68 65 20 | resourc|es. The |
|000043a0| 4d 75 6c 74 69 46 69 6e | 64 65 72 20 6d 65 6d 6f |MultiFin|der memo|
|000043b0| 72 79 20 73 70 61 63 65 | 20 69 73 20 73 65 74 20 |ry space| is set |
|000043c0| 75 70 20 61 73 20 73 68 | 61 72 65 64 20 6d 65 6d |up as sh|ared mem|
|000043d0| 6f 72 79 2c 20 61 6e 64 | 20 73 69 6e 63 65 20 74 |ory, and| since t|
|000043e0| 68 65 20 63 68 69 6c 64 | 20 69 6e 20 55 4e 49 58 |he child| in UNIX|
|000043f0| 20 69 6e 68 65 72 69 74 | 73 20 61 6c 6c 20 73 68 | inherit|s all sh|
|00004400| 61 72 65 64 20 6d 65 6d | 6f 72 79 20 73 65 67 6d |ared mem|ory segm|
|00004410| 65 6e 74 73 20 66 72 6f | 6d 20 74 68 65 20 70 61 |ents fro|m the pa|
|00004420| 72 65 6e 74 20 61 63 72 | 6f 73 73 20 74 68 65 20 |rent acr|oss the |
|00004430| 66 6f 72 6b 2c 20 62 6f | 74 68 20 74 68 65 20 70 |fork, bo|th the p|
|00004440| 61 72 65 6e 74 20 70 72 | 6f 63 65 73 73 20 61 6e |arent pr|ocess an|
|00004450| 64 20 74 68 65 20 63 68 | 69 6c 64 20 70 72 6f 63 |d the ch|ild proc|
|00004460| 65 73 73 20 77 69 6c 6c | 20 62 65 20 75 73 69 6e |ess will| be usin|
|00004470| 67 20 74 68 65 20 73 61 | 6d 65 20 73 74 61 63 6b |g the sa|me stack|
|00004480| 2e 20 54 68 69 73 20 77 | 69 6c 6c 20 6c 65 61 64 |. This w|ill lead|
|00004490| 20 74 6f 20 63 68 61 6f | 73 20 69 66 20 74 68 65 | to chao|s if the|
|000044a0| 20 63 68 69 6c 64 20 70 | 75 73 68 65 73 20 73 6f | child p|ushes so|
|000044b0| 6d 65 74 68 69 6e 67 20 | 74 6f 20 74 68 65 20 73 |mething |to the s|
|000044c0| 74 61 63 6b 20 77 68 69 | 6c 65 20 74 68 65 20 70 |tack whi|le the p|
|000044d0| 61 72 65 6e 74 20 72 65 | 6d 6f 76 65 73 20 74 68 |arent re|moves th|
|000044e0| 65 20 64 61 74 61 2c 20 | 6f 72 20 76 69 63 65 20 |e data, |or vice |
|000044f0| 76 65 72 73 61 2e 20 54 | 68 65 20 63 68 69 6c 64 |versa. T|he child|
|00004500| 20 73 68 6f 75 6c 64 20 | 68 61 76 65 20 61 20 73 | should |have a s|
|00004510| 65 70 61 72 61 74 65 20 | 73 74 61 63 6b 20 75 6e |eparate |stack un|
|00004520| 74 69 6c 20 77 65 20 68 | 61 76 65 20 64 6f 6e 65 |til we h|ave done|
|00004530| 20 61 6e 20 65 78 65 63 | 28 29 2c 20 74 68 65 6e | an exec|(), then|
|00004540| 20 74 68 65 20 63 68 69 | 6c 64 20 70 72 6f 63 65 | the chi|ld proce|
|00004550| 73 73 20 68 61 73 20 69 | 74 d5 73 20 6f 77 6e 20 |ss has i|t.s own |
|00004560| 6d 65 6d 6f 72 79 20 77 | 6f 72 6c 64 2e 0d 00 2a |memory w|orld...*|
|00004570| 00 00 0c 00 00 14 00 32 | 0c 00 00 16 00 38 0c 00 |.......2|.....8..|
|00004580| 00 14 00 cf 0c 00 00 16 | 00 d5 0c 00 00 14 02 ec |........|........|
|00004590| 0c 00 00 16 02 f2 0c 00 | 00 14 00 01 0d 14 00 06 |........|........|
|000045a0| 00 00 0c 00 00 14 01 35 | 53 6f 20 77 68 61 74 20 |.......5|So what |
|000045b0| 77 65 20 6e 65 65 64 20 | 74 6f 20 64 6f 20 69 73 |we need |to do is|
|000045c0| 20 74 6f 20 73 65 74 20 | 75 70 20 61 20 73 65 70 | to set |up a sep|
|000045d0| 61 72 61 74 65 20 64 61 | 74 61 20 61 72 65 61 20 |arate da|ta area |
|000045e0| 66 6f 72 20 74 68 65 20 | 63 68 69 6c 64 27 73 20 |for the |child's |
|000045f0| 70 72 6f 63 65 73 73 20 | 73 74 61 63 6b 20 75 73 |process |stack us|
|00004600| 65 2e 20 54 68 65 20 63 | 68 69 6c 64 20 70 72 6f |e. The c|hild pro|
|00004610| 63 65 73 73 20 77 69 6c | 6c 20 67 65 74 20 69 74 |cess wil|l get it|
|00004620| 73 20 6f 77 6e 20 64 61 | 74 61 20 61 72 65 61 20 |s own da|ta area |
|00004630| 62 79 20 61 6c 6c 6f 63 | 61 74 69 6e 67 20 65 6e |by alloc|ating en|
|00004640| 6f 75 67 68 20 73 74 61 | 63 6b 20 73 70 61 63 65 |ough sta|ck space|
|00004650| 20 62 79 20 74 68 65 20 | 70 61 72 65 6e 74 20 62 | by the |parent b|
|00004660| 65 66 6f 72 65 20 74 68 | 65 20 66 6f 72 6b 28 29 |efore th|e fork()|
|00004670| 2c 20 61 6e 64 20 70 61 | 73 73 69 6e 67 20 74 68 |, and pa|ssing th|
|00004680| 69 73 20 73 70 61 63 65 | 20 74 6f 20 74 68 65 20 |is space| to the |
|00004690| 66 6f 72 6b 28 29 20 73 | 79 73 74 65 6d 20 63 61 |fork() s|ystem ca|
|000046a0| 6c 6c 20 75 73 69 6e 67 | 20 61 20 73 70 65 63 69 |ll using| a speci|
|000046b0| 61 6c 20 66 6f 72 6b 28 | 29 20 63 61 6c 6c 2c 20 |al fork(|) call, |
|000046c0| 77 68 69 63 68 20 69 73 | 20 65 78 70 6c 61 69 6e |which is| explain|
|000046d0| 65 64 20 6c 61 74 65 72 | 2e 20 20 20 0d 90 00 2a |ed later|. ...*|
|000046e0| 00 00 0c 00 00 14 00 c2 | 0c 00 00 16 00 c8 0c 00 |........|........|
|000046f0| 00 14 00 e8 0c 00 00 16 | 00 ef 0c 00 00 14 01 0b |........|........|
|00004700| 0c 00 00 16 01 11 0c 00 | 00 14 00 01 0d ff 00 06 |........|........|
|00004710| 00 00 0c 00 00 14 01 a8 | 54 68 65 20 66 6f 72 6b |........|The fork|
|00004720| 28 29 20 73 79 73 74 65 | 6d 20 63 61 6c 6c 20 63 |() syste|m call c|
|00004730| 6f 70 69 65 73 20 74 68 | 65 20 63 75 72 72 65 6e |opies th|e curren|
|00004740| 74 20 73 74 61 63 6b 20 | 66 72 61 6d 65 20 6f 66 |t stack |frame of|
|00004750| 20 74 68 65 20 70 61 72 | 65 6e 74 20 6f 6e 74 6f | the par|ent onto|
|00004760| 20 74 68 65 20 6e 65 77 | 20 73 74 61 63 6b 20 73 | the new| stack s|
|00004770| 70 61 63 65 2c 20 72 65 | 73 65 74 73 20 74 68 65 |pace, re|sets the|
|00004780| 20 73 74 61 63 6b 20 70 | 6f 69 6e 74 65 72 20 74 | stack p|ointer t|
|00004790| 6f 20 70 6f 69 6e 74 20 | 74 6f 20 74 68 65 20 6e |o point |to the n|
|000047a0| 65 77 20 73 74 61 63 6b | 20 69 6e 20 74 68 65 20 |ew stack| in the |
|000047b0| 63 68 69 6c 64 2c 20 61 | 6e 64 20 74 68 65 6e 20 |child, a|nd then |
|000047c0| 69 73 73 75 65 73 20 74 | 68 65 20 74 72 61 70 20 |issues t|he trap |
|000047d0| 74 6f 20 6a 75 6d 70 20 | 69 6e 74 6f 20 74 68 65 |to jump |into the|
|000047e0| 20 55 6e 69 78 20 6b 65 | 72 6e 65 6c 20 74 6f 20 | Unix ke|rnel to |
|000047f0| 63 6f 6e 74 69 6e 75 65 | 20 74 6f 20 73 65 74 20 |continue| to set |
|00004800| 75 70 20 74 68 65 20 6e | 65 77 20 70 72 6f 63 65 |up the n|ew proce|
|00004810| 73 73 20 73 74 72 75 63 | 74 75 72 65 73 2e 20 54 |ss struc|tures. T|
|00004820| 68 69 73 20 65 6e 61 62 | 6c 65 73 20 74 68 65 20 |his enab|les the |
|00004830| 63 68 69 6c 64 20 74 6f | 20 61 63 63 65 73 73 20 |child to| access |
|00004840| 69 6e 66 6f 72 6d 61 74 | 69 6f 6e 20 66 72 6f 6d |informat|ion from|
|00004850| 20 74 68 65 20 73 74 61 | 63 6b 20 69 6e 20 74 68 | the sta|ck in th|
|00004860| 65 20 73 61 6d 65 20 6d | 61 6e 6e 65 72 20 61 73 |e same m|anner as|
|00004870| 20 61 6e 79 20 6f 74 68 | 65 72 20 70 72 6f 63 65 | any oth|er proce|
|00004880| 73 73 2e 20 44 65 74 61 | 69 6c 73 20 74 6f 20 6b |ss. Deta|ils to k|
|00004890| 65 65 70 20 69 6e 20 6d | 69 6e 64 20 77 68 69 6c |eep in m|ind whil|
|000048a0| 65 20 75 73 69 6e 67 20 | 74 68 69 73 20 6d 65 63 |e using |this mec|
|000048b0| 68 61 6e 69 73 6d 20 61 | 72 65 20 3a 20 20 20 0d |hanism a|re : .|
|000048c0| 00 12 00 00 0c 00 00 14 | 00 03 0c 00 00 16 00 0a |........|........|
|000048d0| 0c 00 00 14 00 01 0d 00 | 00 06 00 00 0c 00 00 14 |........|........|
|000048e0| 00 82 61 29 20 41 6c 6c | 6f 63 61 74 65 20 6d 65 |..a) All|ocate me|
|000048f0| 6d 6f 72 79 20 66 6f 72 | 20 74 68 65 20 73 74 61 |mory for| the sta|
|00004900| 63 6b 20 77 68 69 63 68 | 20 69 73 20 67 75 61 72 |ck which| is guar|
|00004910| 61 6e 74 65 65 64 20 6e | 6f 74 20 74 6f 20 62 65 |anteed n|ot to be|
|00004920| 20 66 72 65 65 64 20 75 | 6e 74 69 6c 20 61 66 74 | freed u|ntil aft|
|00004930| 65 72 20 74 68 65 20 63 | 68 69 6c 64 20 70 72 6f |er the c|hild pro|
|00004940| 63 65 73 73 20 68 61 73 | 20 63 6f 6d 70 6c 65 74 |cess has| complet|
|00004950| 65 64 20 69 74 73 20 65 | 78 65 63 2e 20 20 20 20 |ed its e|xec. |
|00004960| 20 20 20 0d 00 06 00 00 | 0c 00 00 14 00 01 0d 68 | .....|.......h|
|00004970| 00 06 00 00 0c 00 00 14 | 00 7a 62 29 20 50 61 73 |........|.zb) Pas|
|00004980| 73 20 74 68 65 20 61 64 | 64 72 65 73 73 20 6f 66 |s the ad|dress of|
|00004990| 20 74 68 65 20 68 69 67 | 68 20 6d 65 6d 6f 72 79 | the hig|h memory|
|000049a0| 20 65 6e 64 20 6f 66 20 | 74 68 65 20 61 6c 6c 6f | end of |the allo|
|000049b0| 63 61 74 65 64 20 6d 65 | 6d 6f 72 79 20 66 6f 72 |cated me|mory for|
|000049c0| 20 74 68 65 20 73 74 61 | 63 6b 20 74 6f 20 66 6f | the sta|ck to fo|
|000049d0| 72 6b 28 29 2c 20 6e 6f | 74 20 74 68 65 20 6c 6f |rk(), no|t the lo|
|000049e0| 77 20 6d 65 6d 6f 72 79 | 20 61 64 64 72 65 73 73 |w memory| address|
|000049f0| 2e 20 20 0d 00 12 00 00 | 0c 00 00 14 00 54 0c 00 |. .....|.....T..|
|00004a00| 00 16 00 5a 0c 00 00 14 | 00 1c 20 20 20 20 20 20 |...Z....|.. |
|00004a10| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004a20| 20 20 20 20 20 0d 00 06 | 00 00 0c 00 00 14 00 dc | ...|........|
|00004a30| 63 29 20 54 68 65 20 61 | 64 64 72 65 73 73 20 74 |c) The a|ddress t|
|00004a40| 6f 20 62 65 20 70 61 73 | 73 65 64 20 61 73 20 74 |o be pas|sed as t|
|00004a50| 68 65 20 63 61 6c 6c 65 | 72 2d 65 6e 76 69 72 6f |he calle|r-enviro|
|00004a60| 6e 6d 65 6e 74 20 61 72 | 67 75 6d 65 6e 74 20 69 |nment ar|gument i|
|00004a70| 73 20 63 6f 6d 70 75 74 | 65 64 20 64 69 66 66 65 |s comput|ed diffe|
|00004a80| 72 65 6e 74 6c 79 20 64 | 65 70 65 6e 64 69 6e 67 |rently d|epending|
|00004a90| 20 6f 6e 20 77 68 65 74 | 68 65 72 20 74 68 65 20 | on whet|her the |
|00004aa0| 63 61 6c 6c 69 6e 67 20 | 72 6f 75 74 69 6e 65 20 |calling |routine |
|00004ab0| 68 61 73 20 61 20 50 61 | 73 63 61 6c 20 6f 72 20 |has a Pa|scal or |
|00004ac0| 61 20 43 20 73 74 61 63 | 6b 20 66 72 61 6d 65 2e |a C stac|k frame.|
|00004ad0| 20 54 68 65 20 65 78 61 | 6d 70 6c 65 73 20 67 69 | The exa|mples gi|
|00004ae0| 76 65 6e 20 6c 61 74 65 | 72 20 73 68 6f 77 20 68 |ven late|r show h|
|00004af0| 6f 77 20 74 68 65 20 63 | 61 6c 63 75 6c 61 74 69 |ow the c|alculati|
|00004b00| 6f 6e 20 69 73 20 64 6f | 6e 65 2e 0d 00 06 00 00 |on is do|ne......|
|00004b10| 0c 00 00 14 00 01 0d 42 | 00 06 00 00 0c 00 00 14 |.......B|........|
|00004b20| 00 e7 64 29 20 54 68 65 | 20 63 61 6c 6c 69 6e 67 |..d) The| calling|
|00004b30| 20 72 6f 75 74 69 6e 65 | 20 6e 65 65 64 73 20 74 | routine| needs t|
|00004b40| 6f 20 62 65 20 76 65 72 | 79 20 63 61 72 65 66 75 |o be ver|y carefu|
|00004b50| 6c 20 61 62 6f 75 74 20 | 77 68 61 74 20 74 68 65 |l about |what the|
|00004b60| 20 63 68 69 6c 64 20 64 | 6f 65 73 20 62 65 66 6f | child d|oes befo|
|00004b70| 72 65 20 65 78 65 63 28 | 29 20 6f 72 20 65 78 69 |re exec(|) or exi|
|00004b80| 74 28 29 2e 20 50 6f 69 | 6e 74 65 72 73 20 61 6e |t(). Poi|nters an|
|00004b90| 64 20 73 74 72 75 63 74 | 75 72 65 73 20 61 63 63 |d struct|ures acc|
|00004ba0| 65 73 73 65 64 20 76 69 | 61 20 74 68 65 20 73 74 |essed vi|a the st|
|00004bb0| 61 63 6b 20 77 69 6c 6c | 20 70 6f 69 6e 74 20 74 |ack will| point t|
|00004bc0| 6f 20 74 68 65 20 70 61 | 72 65 6e 74 27 73 20 63 |o the pa|rent's c|
|00004bd0| 6f 70 79 2c 20 73 69 6e | 63 65 20 6f 6e 6c 79 20 |opy, sin|ce only |
|00004be0| 74 68 65 20 6c 6f 63 61 | 6c 2f 63 75 72 72 65 6e |the loca|l/curren|
|00004bf0| 74 20 66 72 61 6d 65 20 | 68 61 73 20 62 65 65 6e |t frame |has been|
|00004c00| 20 63 6f 70 69 65 64 2e | 0d ff 00 1e 00 00 0c 00 | copied.|........|
|00004c10| 00 14 00 51 0c 00 00 16 | 00 57 0c 00 00 14 00 5b |...Q....|.W.....[|
|00004c20| 0c 00 00 16 00 61 0c 00 | 00 14 00 01 0d 8b 00 06 |.....a..|........|
|00004c30| 00 00 0c 00 00 14 02 79 | 49 6e 20 70 61 72 74 69 |.......y|In parti|
|00004c40| 63 75 6c 61 72 20 61 6c | 6c 6f 63 61 74 69 6f 6e |cular al|location|
|00004c50| 20 6f 66 20 6c 61 72 67 | 65 20 61 72 72 61 79 73 | of larg|e arrays|
|00004c60| 20 73 68 6f 75 6c 64 20 | 62 65 20 64 6f 6e 65 20 | should |be done |
|00004c70| 6f 6e 6c 79 20 61 66 74 | 65 72 20 65 6e 73 75 72 |only aft|er ensur|
|00004c80| 69 6e 67 20 74 68 61 74 | 20 74 68 65 20 73 70 61 |ing that| the spa|
|00004c90| 63 65 20 61 6c 6c 6f 63 | 61 74 65 64 20 66 6f 72 |ce alloc|ated for|
|00004ca0| 20 74 68 65 20 63 68 69 | 6c 64 20 73 74 61 63 6b | the chi|ld stack|
|00004cb0| 20 69 73 20 73 75 66 66 | 69 63 69 65 6e 74 6c 79 | is suff|iciently|
|00004cc0| 20 6c 61 72 67 65 20 74 | 6f 20 63 6f 70 79 20 74 | large t|o copy t|
|00004cd0| 68 65 20 65 6e 74 69 72 | 65 20 73 74 61 63 6b 20 |he entir|e stack |
|00004ce0| 66 72 61 6d 65 2e 20 54 | 68 69 73 20 69 73 20 69 |frame. T|his is i|
|00004cf0| 6d 70 6f 72 74 61 6e 74 | 20 62 65 63 61 75 73 65 |mportant| because|
|00004d00| 20 61 72 72 61 79 73 20 | 63 6f 75 6c 64 20 62 65 | arrays |could be|
|00004d10| 20 61 6c 6c 6f 63 61 74 | 65 64 20 6f 6e 20 74 68 | allocat|ed on th|
|00004d20| 65 20 73 74 61 63 6b 2c | 20 61 6e 64 20 74 68 65 |e stack,| and the|
|00004d30| 72 65 20 63 6f 75 6c 64 | 20 65 78 69 73 74 20 61 |re could| exist a|
|00004d40| 72 72 61 79 20 73 69 7a | 65 73 20 77 68 69 63 68 |rray siz|es which|
|00004d50| 20 63 61 75 73 65 20 74 | 68 65 20 63 75 72 72 65 | cause t|he curre|
|00004d60| 6e 74 20 73 74 61 63 6b | 20 66 72 61 6d 65 20 73 |nt stack| frame s|
|00004d70| 69 7a 65 20 74 6f 20 65 | 78 63 65 65 64 20 74 68 |ize to e|xceed th|
|00004d80| 61 74 20 6f 66 20 74 68 | 65 20 61 6c 6c 6f 63 61 |at of th|e alloca|
|00004d90| 74 65 64 20 63 68 69 6c | 64 20 73 74 61 63 6b 20 |ted chil|d stack |
|00004da0| 73 70 61 63 65 2e 20 54 | 68 69 73 20 77 69 6c 6c |space. T|his will|
|00004db0| 20 72 65 73 75 6c 74 20 | 69 6e 20 6f 6e 6c 79 20 | result |in only |
|00004dc0| 70 61 72 74 20 6f 66 20 | 74 68 65 20 63 75 72 72 |part of |the curr|
|00004dd0| 65 6e 74 20 73 74 61 63 | 6b 20 66 72 61 6d 65 20 |ent stac|k frame |
|00004de0| 62 65 69 6e 67 20 63 6f | 70 69 65 64 20 6f 76 65 |being co|pied ove|
|00004df0| 72 20 6f 6e 74 6f 20 74 | 68 65 20 63 68 69 6c 64 |r onto t|he child|
|00004e00| 2e 20 49 6e 20 73 75 63 | 68 20 63 61 73 65 73 20 |. In suc|h cases |
|00004e10| 73 65 65 6d 69 6e 67 6c | 79 20 6e 6f 72 6d 61 6c |seemingl|y normal|
|00004e20| 20 61 63 63 65 73 73 65 | 73 20 66 72 6f 6d 20 74 | accesse|s from t|
|00004e30| 68 65 20 63 68 69 6c 64 | 20 77 69 6c 6c 20 65 6e |he child| will en|
|00004e40| 64 20 75 70 20 62 65 69 | 6e 67 20 69 6e 20 74 68 |d up bei|ng in th|
|00004e50| 65 20 77 72 6f 6e 67 20 | 61 72 65 61 20 61 6e 64 |e wrong |area and|
|00004e60| 20 63 61 75 73 65 20 73 | 74 72 61 6e 67 65 20 62 | cause s|trange b|
|00004e70| 65 68 61 76 69 6f 72 20 | 28 74 68 65 20 73 63 72 |ehavior |(the scr|
|00004e80| 65 65 6e 20 69 73 20 6c | 6f 63 6b 65 64 20 75 70 |een is l|ocked up|
|00004e90| 2c 20 62 75 73 20 65 72 | 72 6f 72 73 20 61 72 65 |, bus er|rors are|
|00004ea0| 20 66 72 65 71 75 65 6e | 74 20 65 74 63 2e 29 2e | frequen|t etc.).|
|00004eb0| 0d ff 00 06 00 00 0c 00 | 00 14 00 01 0d ff 00 06 |........|........|
|00004ec0| 00 00 0c 00 00 14 01 73 | 55 73 69 6e 67 20 6d 61 |.......s|Using ma|
|00004ed0| 6c 6c 6f 63 28 29 20 61 | 6e 64 20 66 72 65 65 28 |lloc() a|nd free(|
|00004ee0| 29 20 74 6f 20 61 6c 6c | 6f 63 61 74 65 64 20 73 |) to all|ocated s|
|00004ef0| 70 61 63 65 20 66 6f 72 | 20 73 75 63 68 20 6c 61 |pace for| such la|
|00004f00| 72 67 65 20 62 75 66 66 | 65 72 73 20 6f 6e 20 74 |rge buff|ers on t|
|00004f10| 68 65 20 68 65 61 70 20 | 77 69 6c 6c 20 65 6c 69 |he heap |will eli|
|00004f20| 6d 69 6e 61 74 65 20 74 | 68 69 73 20 70 72 6f 62 |minate t|his prob|
|00004f30| 6c 65 6d 2e 20 48 6f 77 | 65 76 65 72 20 6f 6e 65 |lem. How|ever one|
|00004f40| 20 6e 65 65 64 73 20 74 | 6f 20 62 65 20 61 77 61 | needs t|o be awa|
|00004f50| 72 65 20 74 68 61 74 20 | 74 68 6f 75 67 68 20 74 |re that |though t|
|00004f60| 68 65 20 73 70 61 63 65 | 20 69 73 20 61 6c 6c 6f |he space| is allo|
|00004f70| 63 61 74 65 64 20 6f 6e | 20 74 68 65 20 68 65 61 |cated on| the hea|
|00004f80| 70 2c 20 74 68 65 20 73 | 70 61 63 65 20 69 73 20 |p, the s|pace is |
|00004f90| 61 63 63 65 73 73 65 64 | 20 76 69 61 20 61 20 70 |accessed| via a p|
|00004fa0| 6f 69 6e 74 65 72 20 77 | 68 69 63 68 20 69 73 20 |ointer w|hich is |
|00004fb0| 6f 6e 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 73 |on the c|urrent s|
|00004fc0| 74 61 63 6b 20 66 72 61 | 6d 65 2e 20 54 68 69 73 |tack fra|me. This|
|00004fd0| 20 6d 65 61 6e 73 20 74 | 68 61 74 20 61 63 63 65 | means t|hat acce|
|00004fe0| 73 73 65 73 20 66 72 6f | 6d 20 74 68 65 20 63 68 |sses fro|m the ch|
|00004ff0| 69 6c 64 20 74 6f 20 74 | 68 65 20 73 70 61 63 65 |ild to t|he space|
|00005000| 20 69 6e 20 71 75 65 73 | 74 69 6f 6e 20 77 69 6c | in ques|tion wil|
|00005010| 6c 20 72 65 73 75 6c 74 | 20 69 6e 20 61 63 63 65 |l result| in acce|
|00005020| 73 73 65 73 20 74 6f 20 | 74 68 65 20 70 61 72 65 |sses to |the pare|
|00005030| 6e 74 27 73 20 63 6f 70 | 79 2e 0d ff 00 1e 00 00 |nt's cop|y.......|
|00005040| 0c 00 00 14 00 06 0c 00 | 00 16 00 0e 0c 00 00 14 |........|........|
|00005050| 00 13 0c 00 00 16 00 1a | 0c 00 00 14 00 01 0d ff |........|........|
|00005060| 00 06 00 00 0c 00 00 14 | 00 74 65 29 20 54 68 65 |........|.te) The|
|00005070| 20 70 61 72 65 6e 74 20 | 6d 75 73 74 20 63 6c 65 | parent |must cle|
|00005080| 61 6e 20 75 70 20 6f 66 | 20 74 68 65 20 61 6c 6c |an up of| the all|
|00005090| 6f 63 61 74 65 64 20 73 | 70 61 63 65 20 66 6f 72 |ocated s|pace for|
|000050a0| 20 74 68 65 20 69 6e 74 | 65 72 69 6d 20 73 74 61 | the int|erim sta|
|000050b0| 63 6b 20 66 6f 72 20 74 | 68 65 20 63 68 69 6c 64 |ck for t|he child|
|000050c0| 20 61 66 74 65 72 20 74 | 68 65 20 63 68 69 6c 64 | after t|he child|
|000050d0| 20 68 61 73 20 65 78 69 | 74 3a 65 64 2e 0d 00 06 | has exi|t:ed....|
|000050e0| 00 00 0c 00 00 14 00 01 | 0d ff 00 06 00 00 0c 00 |........|........|
|000050f0| 00 10 00 01 0d 94 00 06 | 00 00 0c 00 00 14 00 6d |........|.......m|
|00005100| 54 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 20 70 69 |The foll|owing pi|
|00005110| 63 74 75 72 65 20 69 6c | 6c 75 73 74 72 61 74 65 |cture il|lustrate|
|00005120| 73 20 68 6f 77 20 74 68 | 65 20 73 74 61 63 6b 20 |s how th|e stack |
|00005130| 70 61 72 61 6d 65 74 65 | 72 20 70 61 73 73 69 6e |paramete|r passin|
|00005140| 67 20 69 73 20 64 6f 6e | 65 20 77 69 74 68 20 61 |g is don|e with a|
|00005150| 20 50 61 73 63 61 6c 20 | 73 74 61 63 6b 20 61 6e | Pascal |stack an|
|00005160| 64 20 61 20 43 20 73 74 | 61 63 6b 3a 0d 00 00 06 |d a C st|ack:....|
|00005170| 00 00 0c 00 00 14 00 01 | 0d 01 00 06 00 00 0c 00 |........|........|
|00005180| 00 14 00 01 0d ff 00 06 | 00 00 0c 00 00 14 00 00 |........|........|
|00005190| 01 e6 00 0a 00 00 00 00 | 00 24 00 48 00 6c 00 90 |........|.$.H.l..|
|000051a0| 00 b4 00 d8 00 fc 01 20 | 01 44 01 68 00 00 00 00 |....... |.D.h....|
|000051b0| 00 00 00 00 00 ed 01 d4 | 09 e8 ff ff 00 09 00 ec |........|........|
|000051c0| 01 dd 00 11 02 ff 0c 00 | ff ff ff ff 00 09 00 00 |........|........|
|000051d0| ff ff 00 00 01 dd 00 00 | 00 ec 00 00 00 00 00 00 |........|........|
|000051e0| 00 a0 00 82 00 a1 00 96 | 00 0c 01 00 00 00 02 00 |........|........|
|000051f0| 00 00 00 00 00 00 00 a1 | 00 9a 00 08 ff fc 00 00 |........|........|
|00005200| 00 26 00 00 00 1e 00 01 | 00 0a 00 00 01 91 00 10 |.&......|........|
|00005210| 01 dc 00 2c 00 09 00 03 | 06 47 65 6e 65 76 61 00 |...,....|.Geneva.|
|00005220| 00 03 00 03 00 0d 00 0c | 00 10 00 01 00 ea 00 01 |........|........|
|00005230| 00 f5 00 28 00 0c 01 92 | 0b 48 69 67 68 20 4d 65 |...(....|.High Me|
|00005240| 6d 6f 72 79 00 a0 00 97 | 00 a1 00 96 00 0c 01 00 |mory....|........|
|00005250| 00 00 02 00 00 00 00 00 | 00 00 00 a1 00 9a 00 08 |........|........|
|00005260| ff fc 00 00 00 25 00 00 | 00 01 00 0a 00 be 01 8e |.....%..|........|
|00005270| 00 ce 01 d7 00 28 00 ca | 01 8f 0a 4c 6f 77 20 4d |.....(..|...Low M|
|00005280| 65 6d 6f 72 79 00 00 a0 | 00 97 00 a1 00 64 00 0a |emory...|.....d..|
|00005290| 4d 44 50 4c 00 09 00 01 | 00 02 00 a0 00 8c 00 01 |MDPL....|........|
|000052a0| 00 0a ff ff 00 09 00 ec | 01 dd 00 71 00 1e 00 a6 |........|...q....|
|000052b0| 01 af 00 b4 01 b7 00 b4 | 01 b3 00 a6 01 af 00 a6 |........|........|
|000052c0| 01 b3 00 a6 01 b7 00 b4 | 01 b3 00 20 00 1b 01 b3 |........|... ....|
|000052d0| 00 a6 01 b3 00 a0 00 8d | 00 a1 00 64 00 08 4d 44 |........|...d..MD|
|000052e0| 50 4c 00 0a 00 00 00 09 | 00 00 00 00 00 00 00 00 |PL......|........|
|000052f0| 00 31 00 0c 00 41 00 c0 | 00 a0 00 07 00 02 00 02 |.1...A..|........|
|00005300| 00 09 ff ff ff ff ff ff | ff ff 00 30 00 0b 00 40 |........|...0...@|
|00005310| 00 c1 00 a1 00 20 00 65 | 00 15 00 65 00 9f 00 a1 |..... .e|...e....|
|00005320| 00 96 00 0c 01 00 00 00 | 02 00 00 00 00 00 00 00 |........|........|
|00005330| 00 a1 00 9a 00 08 ff fc | 00 00 00 0e 00 00 00 01 |........|........|
|00005340| 00 0a 00 14 00 19 00 24 | 00 37 00 04 01 00 00 28 |.......$|.7.....(|
|00005350| 00 20 00 1a 04 66 6f 72 | 6b 00 00 a0 00 97 00 01 |. ...for|k.......|
|00005360| 00 0a ff ff 00 09 00 ec | 01 dd 00 07 00 01 00 01 |........|........|
|00005370| 00 22 00 2a 00 41 5f 00 | 00 22 00 3f 00 42 5f 00 |.".*.A_.|.".?.B_.|
|00005380| 00 22 00 53 00 41 5f 00 | 00 a1 00 96 00 0c 01 00 |.".S.A_.|........|
|00005390| 00 00 02 00 00 00 00 00 | 00 00 00 a1 00 9a 00 08 |........|........|
|000053a0| ff fc 00 00 00 2a 00 00 | 00 01 00 0a 00 2d 00 49 |.....*..|.....-.I|
|000053b0| 00 3a 00 9c 00 0d 00 0a | 00 2b 30 17 0e 72 65 74 |.:......|.+0..ret|
|000053c0| 75 72 6e 20 61 64 64 72 | 65 73 73 00 00 a0 00 97 |urn addr|ess.....|
|000053d0| 00 a1 00 96 00 0c 01 00 | 00 00 02 00 00 00 00 00 |........|........|
|000053e0| 00 00 00 a1 00 9a 00 08 | ff fc 00 00 00 23 00 00 |........|.....#..|
|000053f0| 00 01 00 0a 00 42 00 4c | 00 4f 00 93 00 15 ce 00 |.....B.L|.O......|
|00005400| 00 2b 03 15 0c 26 43 68 | 69 6c 64 20 73 74 61 63 |.+...&Ch|ild stac|
|00005410| 6b 00 00 a0 00 97 00 a1 | 00 96 00 0c 01 00 00 00 |k.......|........|
|00005420| 02 00 00 00 00 00 00 00 | 00 a1 00 9a 00 08 ff fc |........|........|
|00005430| 00 00 00 02 00 00 00 01 | 00 0a 00 57 00 67 00 64 |........|...W.g.d|
|00005440| 00 6e 00 15 ab 00 00 2b | 1b 15 01 58 00 a0 00 97 |.n.....+|...X....|
|00005450| 00 a1 00 96 00 0c 01 00 | 00 00 02 00 00 00 00 00 |........|........|
|00005460| 00 00 00 a1 00 9a 00 08 | ff fc 00 00 00 03 00 00 |........|........|
|00005470| 00 01 00 0a 00 59 00 b2 | 00 66 00 ba 00 15 5e 00 |.....Y..|.f....^.|
|00005480| 00 2b 4b 02 01 59 00 a0 | 00 97 00 01 00 0a ff ff |.+K..Y..|........|
|00005490| 00 09 00 ec 01 dd 00 22 | 00 ad 00 41 5f 00 00 22 |......."|...A_.."|
|000054a0| 00 9b 00 41 5f 00 00 22 | 00 88 00 41 5f 00 00 22 |...A_.."|...A_.."|
|000054b0| 00 76 00 41 5f 00 00 a1 | 00 96 00 0c 01 00 00 00 |.v.A_...|........|
|000054c0| 02 00 00 00 00 00 00 00 | 00 a1 00 9a 00 08 ff fc |........|........|
|000054d0| 00 00 00 2a 00 00 00 01 | 00 0a 00 78 00 47 00 85 |...*....|...x.G..|
|000054e0| 00 9a 00 28 00 82 00 48 | 0e 72 65 74 75 72 6e 20 |...(...H|.return |
|000054f0| 61 64 64 72 65 73 73 00 | 00 a0 00 97 00 a1 00 96 |address.|........|
|00005500| 00 0c 01 00 00 00 02 00 | 00 00 00 00 00 00 00 a1 |........|........|
|00005510| 00 9a 00 08 ff fc 00 00 | 00 02 00 00 00 01 00 0a |........|........|
|00005520| 00 8a 00 67 00 97 00 6d | 00 15 ce 00 00 2b 20 12 |...g...m|.....+ .|
|00005530| 01 73 00 a0 00 97 00 a1 | 00 96 00 0c 01 00 00 00 |.s......|........|
|00005540| 02 00 00 00 00 00 00 00 | 00 a1 00 9a 00 08 ff fc |........|........|
|00005550| 00 00 00 03 00 00 00 01 | 00 0a 00 9c 00 67 00 a9 |........|.....g..|
|00005560| 00 70 00 15 8c 00 00 2a | 12 01 72 00 00 a0 00 97 |.p.....*|..r.....|
|00005570| 00 a1 00 96 00 0c 01 00 | 00 00 02 00 00 00 00 00 |........|........|
|00005580| 00 00 00 a1 00 9a 00 08 | ff fc 00 00 00 24 00 00 |........|.....$..|
|00005590| 00 01 00 0a 00 af 00 4c | 00 bc 00 93 00 15 3f 00 |.......L|......?.|
|000055a0| 00 28 00 b9 00 4d 0c 72 | 65 74 75 72 6e 20 76 61 |.(...M.r|eturn va|
|000055b0| 6c 75 65 00 00 a0 00 97 | 00 a1 00 96 00 0c 01 00 |lue.....|........|
|000055c0| 00 00 02 00 00 00 00 00 | 00 00 00 a1 00 9a 00 08 |........|........|
|000055d0| ff fb 00 00 00 19 00 00 | 00 01 00 0a 00 71 00 0a |........|.....q..|
|000055e0| 00 81 00 3c 00 0d 00 0c | 00 15 11 00 00 28 00 7d |...<....|.....(.}|
|000055f0| 00 0b 06 73 79 73 74 65 | 6d 00 00 a0 00 97 00 a1 |...syste|m.......|
|00005600| 00 96 00 0c 01 00 00 00 | 02 00 00 00 00 00 00 00 |........|........|
|00005610| 00 a1 00 9a 00 08 ff fc | 00 00 00 12 00 00 00 01 |........|........|
|00005620| 00 0a 00 7a 00 a6 00 87 | 00 cb 00 0d 00 0a 00 15 |...z....|........|
|00005630| 11 00 00 2b 9c 07 05 58 | 2d 6e 2d 38 00 a0 00 97 |...+...X|-n-8....|
|00005640| 00 a1 00 96 00 0c 01 00 | 00 00 02 00 00 00 00 00 |........|........|
|00005650| 00 00 00 a1 00 9a 00 08 | ff fc 00 00 00 12 00 00 |........|........|
|00005660| 00 01 00 0a 00 8e 00 a6 | 00 9b 00 cb 00 15 6f 00 |........|......o.|
|00005670| 00 2a 14 05 58 2d 6e 2d | 34 00 00 a0 00 97 00 a1 |.*..X-n-|4.......|
|00005680| 00 96 00 0c 01 00 00 00 | 02 00 00 00 00 00 00 00 |........|........|
|00005690| 00 a1 00 9a 00 08 ff fc | 00 00 00 0a 00 00 00 01 |........|........|
|000056a0| 00 0a 00 9f 00 a6 00 ac | 00 bc 00 15 cd 00 00 2a |........|.......*|
|000056b0| 11 03 58 2d 6e 00 00 a0 | 00 97 00 a1 00 96 00 0c |..X-n...|........|
|000056c0| 01 00 00 00 02 00 00 00 | 00 00 00 00 00 a1 00 9a |........|........|
|000056d0| 00 08 ff fc 00 00 00 02 | 00 00 00 01 00 0a 00 b1 |........|........|
|000056e0| 00 a6 00 be 00 ad 00 15 | db 00 00 2a 12 01 58 00 |........|...*..X.|
|000056f0| 00 a0 00 97 00 01 00 0a | ff ff 00 09 00 ec 01 dd |........|........|
|00005700| 00 09 00 00 00 00 00 00 | 00 00 00 31 00 0b 01 0c |........|...1....|
|00005710| 00 bf 01 6a 00 07 00 02 | 00 02 00 09 ff ff ff ff |...j....|........|
|00005720| ff ff ff ff 00 30 00 0a | 01 0b 00 c0 01 6b 00 20 |.....0..|.....k. |
|00005730| 00 64 00 e0 00 64 01 69 | 00 a1 00 96 00 0c 01 00 |.d...d.i|........|
|00005740| 00 00 02 00 00 00 00 00 | 00 00 00 a1 00 9a 00 08 |........|........|
|00005750| ff fb 00 00 00 0e 00 00 | 00 01 00 0a 00 13 00 e4 |........|........|
|00005760| 00 23 01 01 00 0d 00 0c | 00 28 00 1f 00 e5 04 66 |.#......|.(.....f|
|00005770| 6f 72 6b 00 00 a0 00 97 | 00 01 00 0a ff ff 00 09 |ork.....|........|
|00005780| 00 ec 01 dd 00 07 00 01 | 00 01 00 22 00 29 01 0c |........|...".)..|
|00005790| 5e 00 00 22 00 3e 01 0d | 5e 00 00 22 00 52 01 0c |^..".>..|^..".R..|
|000057a0| 5e 00 00 a1 00 96 00 0c | 01 00 00 00 02 00 00 00 |^.......|........|
|000057b0| 00 00 00 00 00 a1 00 9a | 00 08 ff fc 00 00 00 2a |........|.......*|
|000057c0| 00 00 00 01 00 0a 00 2c | 01 13 00 39 01 67 00 0d |.......,|...9.g..|
|000057d0| 00 0a 00 2b 2f 17 0e 72 | 65 74 75 72 6e 20 61 64 |...+/..r|eturn ad|
|000057e0| 64 72 65 73 73 00 00 a0 | 00 97 00 a1 00 96 00 0c |dress...|........|
|000057f0| 01 00 00 00 02 00 00 00 | 00 00 00 00 00 a1 00 9a |........|........|
|00005800| 00 08 ff fc 00 00 00 23 | 00 00 00 01 00 0a 00 41 |.......#|.......A|
|00005810| 01 16 00 4e 01 5d 00 15 | ce 00 00 2b 03 15 0c 26 |...N.]..|...+...&|
|00005820| 43 68 69 6c 64 20 73 74 | 61 63 6b 00 00 a0 00 97 |Child st|ack.....|
|00005830| 00 a1 00 96 00 0c 01 00 | 00 00 02 00 00 00 00 00 |........|........|
|00005840| 00 00 00 a1 00 9a 00 08 | ff fc 00 00 00 02 00 00 |........|........|
|00005850| 00 01 00 0a 00 56 01 31 | 00 63 01 39 00 15 ab 00 |.....V.1|.c.9....|
|00005860| 00 2b 1b 15 01 58 00 a0 | 00 97 00 a1 00 96 00 0c |.+...X..|........|
|00005870| 01 00 00 00 02 00 00 00 | 00 00 00 00 00 a1 00 9a |........|........|
|00005880| 00 08 ff fc 00 00 00 03 | 00 00 00 01 00 0a 00 58 |........|.......X|
|00005890| 01 7d 00 65 01 84 00 15 | 5e 00 00 2b 4b 02 01 59 |.}.e....|^..+K..Y|
|000058a0| 00 a0 00 97 00 01 00 0a | ff ff 00 09 00 ec 01 dd |........|........|
|000058b0| 00 22 00 ac 01 0c 5e 00 | 00 22 00 9a 01 0c 5e 00 |."....^.|."....^.|
|000058c0| 00 22 00 87 01 0c 5e 00 | 00 22 00 75 01 0c 5e 00 |."....^.|.".u..^.|
|000058d0| 00 a1 00 96 00 0c 01 00 | 00 00 02 00 00 00 00 00 |........|........|
|000058e0| 00 00 00 a1 00 9a 00 08 | ff fc 00 00 00 2a 00 00 |........|.....*..|
|000058f0| 00 01 00 0a 00 77 01 12 | 00 84 01 65 00 28 00 81 |.....w..|...e.(..|
|00005900| 01 13 0e 72 65 74 75 72 | 6e 20 61 64 64 72 65 73 |...retur|n addres|
|00005910| 73 00 00 a0 00 97 00 a1 | 00 96 00 0c 01 00 00 00 |s.......|........|
|00005920| 02 00 00 00 00 00 00 00 | 00 a1 00 9a 00 08 ff fc |........|........|
|00005930| 00 00 00 02 00 00 00 01 | 00 0a 00 89 01 31 00 96 |........|.....1..|
|00005940| 01 38 00 15 ce 00 00 2b | 1f 12 01 73 00 a0 00 97 |.8.....+|...s....|
|00005950| 00 a1 00 96 00 0c 01 00 | 00 00 02 00 00 00 00 00 |........|........|
|00005960| 00 00 00 a1 00 9a 00 08 | ff fc 00 00 00 03 00 00 |........|........|
|00005970| 00 01 00 0a 00 9b 01 31 | 00 a8 01 3b 00 15 8c 00 |.......1|...;....|
|00005980| 00 2a 12 01 72 00 00 a0 | 00 97 00 a1 00 96 00 0c |.*..r...|........|
|00005990| 01 00 00 00 02 00 00 00 | 00 00 00 00 00 a1 00 9a |........|........|
|000059a0| 00 08 ff fc 00 00 00 0b | 00 00 00 01 00 0a 00 ae |........|........|
|000059b0| 01 28 00 bb 01 3f 00 15 | 3f 00 00 28 00 b8 01 28 |.(...?..|?..(...(|
|000059c0| 04 66 61 6b 65 00 00 a0 | 00 97 00 a1 00 96 00 0c |.fake...|........|
|000059d0| 01 00 00 00 02 00 00 00 | 00 00 00 00 00 a1 00 9a |........|........|
|000059e0| 00 08 ff fc 00 00 00 19 | 00 00 00 01 00 0a 00 70 |........|.......p|
|000059f0| 00 d4 00 80 01 06 00 0d | 00 0c 00 15 37 00 00 28 |........|....7..(|
|00005a00| 00 7c 00 d5 06 73 79 73 | 74 65 6d 00 00 a0 00 97 |.|...sys|tem.....|
|00005a10| 00 a1 00 96 00 0c 01 00 | 00 00 02 00 00 00 00 00 |........|........|
|00005a20| 00 00 00 a1 00 9a 00 08 | ff fc 00 00 00 0e 00 00 |........|........|
|00005a30| 00 01 00 0a 00 79 01 70 | 00 86 01 8f 00 0d 00 0a |.....y.p|........|
|00005a40| 00 15 37 00 00 2b 9c 07 | 04 58 2d 31 32 00 00 a0 |..7..+..|.X-12...|
|00005a50| 00 97 00 a1 00 96 00 0c | 01 00 00 00 02 00 00 00 |........|........|
|00005a60| 00 00 00 00 00 a1 00 9a | 00 08 ff fc 00 00 00 0a |........|........|
|00005a70| 00 00 00 01 00 0a 00 8d | 01 70 00 9a 01 87 00 15 |........|.p......|
|00005a80| e2 00 00 2a 14 03 58 2d | 38 00 00 a0 00 97 00 a1 |...*..X-|8.......|
|00005a90| 00 96 00 0c 01 00 00 00 | 02 00 00 00 00 00 00 00 |........|........|
|00005aa0| 00 a1 00 9a 00 08 ff fc | 00 00 00 0a 00 00 00 01 |........|........|
|00005ab0| 00 0a 00 9e 01 70 00 ab | 01 87 00 15 e5 00 00 2a |.....p..|.......*|
|00005ac0| 11 03 58 2d 34 00 00 a0 | 00 97 00 a1 00 96 00 0c |..X-4...|........|
|00005ad0| 01 00 00 00 02 00 00 00 | 00 00 00 00 00 a1 00 9a |........|........|
|00005ae0| 00 08 ff fc 00 00 00 02 | 00 00 00 01 00 0a 00 b0 |........|........|
|00005af0| 01 70 00 bd 01 78 00 15 | e8 00 00 2a 12 01 58 00 |.p...x..|...*..X.|
|00005b00| 00 a0 00 97 00 a1 00 96 | 00 0c 01 00 00 00 02 00 |........|........|
|00005b10| 00 00 00 00 00 00 00 a1 | 00 9a 00 08 ff fc 00 00 |........|........|
|00005b20| 00 3e 00 00 00 01 00 0a | 00 da 00 37 00 ea 00 b0 |.>......|...7....|
|00005b30| 00 0d 00 0c 00 15 9b 00 | 00 28 00 e6 00 38 11 50 |........|.(...8.P|
|00005b40| 61 73 63 61 6c 20 43 61 | 6c 6c 20 53 74 61 63 6b |ascal Ca|ll Stack|
|00005b50| 00 a0 00 97 00 a1 00 96 | 00 0c 01 00 00 00 02 00 |........|........|
|00005b60| 00 00 00 00 00 00 00 a1 | 00 9a 00 08 ff fb 00 00 |........|........|
|00005b70| 00 2b 00 00 00 01 00 0a | 00 db 01 0c 00 eb 01 61 |.+......|.......a|
|00005b80| 00 15 9b 00 00 2b d5 01 | 0c 43 20 43 61 6c 6c 20 |.....+..|.C Call |
|00005b90| 53 74 61 63 6b 00 00 a0 | 00 97 00 a0 00 83 00 ff |Stack...|........|
|00005ba0| 00 00 01 e6 03 0a 00 00 | 00 00 00 24 00 48 00 6c |........|...$.H.l|
|00005bb0| 00 90 00 b4 00 d8 00 fc | 01 20 01 44 01 68 00 00 |........|. .D.h..|
|00005bc0| 00 00 00 01 0d ff 00 06 | 00 00 0a 00 00 03 00 25 |........|.......%|
|00005bd0| 09 6e 20 3d 20 73 69 7a | 65 6f 66 28 52 65 74 2e |.n = siz|eof(Ret.|
|00005be0| 20 76 61 6c 75 65 29 20 | 20 20 20 20 20 20 20 20 | value) | |
|00005bf0| 20 20 20 20 0d ff 00 06 | 00 00 0a 00 00 03 00 30 | ....|.......0|
|00005c00| 09 58 20 69 73 20 64 65 | 74 65 72 6d 69 6e 65 64 |.X is de|termined|
|00005c10| 20 74 68 75 73 3b 09 09 | 09 09 58 20 69 73 20 64 | thus;..|..X is d|
|00005c20| 65 74 65 72 6d 69 6e 65 | 64 20 74 68 75 73 3a 0d |etermine|d thus:.|
|00005c30| 00 06 00 00 0a 00 00 03 | 00 22 09 58 20 3d 20 26 |........|.".X = &|
|00005c40| 72 20 2b 20 73 69 7a 65 | 6f 66 28 72 29 20 2b 09 |r + size|of(r) +.|
|00005c50| 09 09 58 20 3d 20 26 66 | 61 6b 65 0d 00 06 00 00 |..X = &f|ake.....|
|00005c60| 0a 00 00 03 00 14 09 73 | 69 7a 65 6f 66 28 52 65 |.......s|izeof(Re|
|00005c70| 74 2e 20 76 61 6c 75 65 | 29 0d 00 06 00 00 0a 00 |t. value|).......|
|00005c80| 00 03 00 01 0d ff 00 06 | 00 00 0a 01 00 03 00 01 |........|........|
|00005c90| 0d ff 00 06 00 00 0a 01 | 00 03 03 03 54 68 65 20 |........|....The |
|00005ca0| 64 65 73 69 67 6e 20 69 | 73 73 75 65 20 6f 66 20 |design i|ssue of |
|00005cb0| 72 65 74 75 72 6e 69 6e | 67 20 74 6f 20 74 68 65 |returnin|g to the|
|00005cc0| 20 63 61 6c 6c 65 72 20 | 66 72 6f 6d 20 66 6f 72 | caller |from for|
|00005cd0| 6b 28 29 20 28 61 73 20 | 6f 70 70 6f 73 65 64 20 |k() (as |opposed |
|00005ce0| 74 6f 20 70 72 6f 76 69 | 64 69 6e 67 20 61 20 66 |to provi|ding a f|
|00005cf0| 6f 72 6b 28 29 2d 65 78 | 65 63 28 29 20 63 6f 6d |ork()-ex|ec() com|
|00005d00| 62 69 6e 61 74 69 6f 6e | 20 77 68 69 63 68 20 64 |bination| which d|
|00005d10| 6f 65 73 20 6e 6f 74 20 | 72 65 74 75 72 6e 20 66 |oes not |return f|
|00005d20| 72 6f 6d 20 74 68 65 20 | 66 6f 72 6b 20 62 75 74 |rom the |fork but|
|00005d30| 20 67 6f 65 73 20 61 68 | 65 61 64 20 61 6e 64 20 | goes ah|ead and |
|00005d40| 65 78 65 63 73 20 74 68 | 65 20 72 65 71 75 69 72 |execs th|e requir|
|00005d50| 65 64 20 70 72 6f 67 72 | 61 6d 20 61 73 20 77 65 |ed progr|am as we|
|00005d60| 6c 6c 29 20 73 68 6f 75 | 6c 64 20 62 65 20 66 61 |ll) shou|ld be fa|
|00005d70| 76 6f 72 65 64 20 61 66 | 74 65 72 20 6c 6f 6f 6b |vored af|ter look|
|00005d80| 69 6e 67 20 69 6e 74 6f | 20 74 68 65 20 70 72 6f |ing into| the pro|
|00005d90| 62 6c 65 6d 20 63 61 72 | 65 66 75 6c 6c 79 2e 20 |blem car|efully. |
|00005da0| 20 50 72 6f 76 69 64 69 | 6e 67 20 61 20 73 65 70 | Providi|ng a sep|
|00005db0| 61 72 61 74 65 20 66 6f | 72 6b 28 29 20 68 61 73 |arate fo|rk() has|
|00005dc0| 20 61 64 76 61 6e 74 61 | 67 65 73 20 69 6e 20 74 | advanta|ges in t|
|00005dd0| 68 65 20 66 6f 72 6d 20 | 6f 66 20 6c 65 74 74 69 |he form |of letti|
|00005de0| 6e 67 20 74 68 65 20 75 | 73 65 72 20 73 65 74 20 |ng the u|ser set |
|00005df0| 75 70 20 63 6f 6d 6d 75 | 6e 69 63 61 74 69 6f 6e |up commu|nication|
|00005e00| 20 63 68 61 6e 6e 65 6c | 73 20 62 65 74 77 65 65 | channel|s betwee|
|00005e10| 6e 20 74 68 65 20 70 61 | 72 65 6e 74 20 61 6e 64 |n the pa|rent and|
|00005e20| 20 63 68 69 6c 64 20 62 | 65 66 6f 72 65 20 65 78 | child b|efore ex|
|00005e30| 65 63 28 29 2c 20 6f 72 | 20 61 6c 6c 6f 77 69 6e |ec(), or| allowin|
|00005e40| 67 20 74 68 65 20 75 73 | 65 72 20 74 6f 20 73 65 |g the us|er to se|
|00005e50| 74 20 75 70 20 74 68 65 | 20 61 70 70 72 6f 70 72 |t up the| appropr|
|00005e60| 69 61 74 65 20 65 6e 76 | 69 72 6f 6e 6d 65 6e 74 |iate env|ironment|
|00005e70| 20 62 65 66 6f 72 65 20 | 65 78 65 63 28 29 2e 20 | before |exec(). |
|00005e80| 54 68 65 20 70 72 6f 62 | 6c 65 6d 73 20 68 61 73 |The prob|lems has|
|00005e90| 20 74 6f 20 64 6f 20 77 | 69 74 68 20 74 68 65 20 | to do w|ith the |
|00005ea0| 70 6f 73 73 69 62 69 6c | 69 74 79 20 6f 66 20 74 |possibil|ity of t|
|00005eb0| 68 65 20 6e 6f 74 2d 73 | 6f 2d 77 61 72 79 20 70 |he not-s|o-wary p|
|00005ec0| 72 6f 67 72 61 6d 6d 65 | 72 20 75 73 69 6e 67 20 |rogramme|r using |
|00005ed0| 74 68 65 20 66 65 61 74 | 75 72 65 20 69 6d 70 72 |the feat|ure impr|
|00005ee0| 6f 70 65 72 6c 79 20 61 | 6e 64 20 6c 65 61 76 69 |operly a|nd leavi|
|00005ef0| 6e 67 20 74 77 6f 20 4d | 61 63 69 6e 74 6f 73 68 |ng two M|acintosh|
|00005f00| 20 65 6e 76 69 72 6f 6e | 6d 65 6e 74 73 20 72 75 | environ|ments ru|
|00005f10| 6e 6e 69 6e 67 20 73 69 | 6d 75 6c 74 61 6e 65 6f |nning si|multaneo|
|00005f20| 75 73 6c 79 2c 20 77 68 | 69 63 68 20 77 69 6c 6c |usly, wh|ich will|
|00005f30| 20 6c 65 61 64 20 74 6f | 20 63 68 61 6f 73 20 76 | lead to| chaos v|
|00005f40| 65 72 79 20 71 75 69 63 | 6b 6c 79 2e 20 54 68 75 |ery quic|kly. Thu|
|00005f50| 73 20 75 73 65 20 6f 66 | 20 66 6f 72 6b 28 29 20 |s use of| fork() |
|00005f60| 66 72 6f 6d 20 77 69 74 | 68 69 6e 20 61 6e 20 61 |from wit|hin an a|
|00005f70| 70 70 6c 69 63 61 74 69 | 6f 6e 20 6d 75 73 74 20 |pplicati|on must |
|00005f80| 62 65 20 64 6f 6e 65 20 | 77 69 74 68 20 65 78 74 |be done |with ext|
|00005f90| 72 65 6d 65 20 63 61 75 | 74 69 6f 6e 2e 20 0d 98 |reme cau|tion. ..|
|00005fa0| 00 42 00 00 0c 00 00 14 | 00 31 0c 00 00 16 00 37 |.B......|.1.....7|
|00005fb0| 0c 00 00 14 00 54 0c 00 | 00 16 00 60 0c 00 00 14 |.....T..|...`....|
|00005fc0| 01 1a 0c 00 00 16 01 20 | 0c 00 00 14 01 92 0c 00 |....... |........|
|00005fd0| 00 16 01 98 0c 00 00 14 | 02 bd 0c 00 00 16 02 c3 |........|........|
|00005fe0| 0c 00 00 14 00 01 0d 06 | 00 06 00 00 0a 01 00 03 |........|........|
|00005ff0| 00 01 0d e5 00 06 00 00 | 0c 00 00 14 00 90 47 69 |........|......Gi|
|00006000| 76 65 6e 20 62 65 6c 6f | 77 20 69 73 20 61 6e 20 |ven belo|w is an |
|00006010| 65 78 61 6d 70 6c 65 20 | 6f 66 20 74 68 65 20 75 |example |of the u|
|00006020| 73 65 20 6f 66 20 41 55 | 58 46 6f 72 6b 28 29 2c |se of AU|XFork(),|
|00006030| 20 61 20 73 70 65 63 69 | 61 6c 20 66 6f 72 6b 28 | a speci|al fork(|
|00006040| 29 20 69 6d 70 6c 65 6d | 65 6e 74 61 74 69 6f 6e |) implem|entation|
|00006050| 2e 20 54 68 69 73 20 65 | 78 61 6d 70 6c 65 20 61 |. This e|xample a|
|00006060| 6c 73 6f 20 73 68 6f 77 | 73 20 68 6f 77 20 74 6f |lso show|s how to|
|00006070| 20 73 65 74 20 75 70 20 | 74 68 65 20 41 2f 55 58 | set up |the A/UX|
|00006080| 20 65 6e 76 69 72 6f 6e | 6d 65 6e 74 2e 0d 00 1e | environ|ment....|
|00006090| 00 00 0c 00 00 14 00 28 | 0c 00 00 16 00 31 0c 00 |.......(|.....1..|
|000060a0| 00 14 00 3d 0c 00 00 16 | 00 43 0c 00 00 14 00 01 |...=....|.C......|
|000060b0| 0d 00 00 06 00 00 0e 01 | 00 14 00 2d 23 64 65 66 |........|...-#def|
|000060c0| 69 6e 65 20 53 54 41 43 | 4b 42 59 54 45 53 20 32 |ine STAC|KBYTES 2|
|000060d0| 30 34 38 09 09 2f 2a 20 | 73 69 7a 65 20 69 6e 20 |048../* |size in |
|000060e0| 62 79 74 65 73 20 2a 2f | 0d ff 00 06 00 00 09 00 |bytes */|........|
|000060f0| 00 16 00 2a 23 64 65 66 | 69 6e 65 20 53 54 41 43 |...*#def|ine STAC|
|00006100| 4b 53 49 5a 45 20 53 54 | 41 43 4b 42 59 54 45 53 |KSIZE ST|ACKBYTES|
|00006110| 2f 73 69 7a 65 6f 66 28 | 6c 6f 6e 67 29 0d 00 06 |/sizeof(|long)...|
|00006120| 00 00 09 00 00 16 00 1b | 75 6e 73 69 67 6e 65 64 |........|unsigned|
|00006130| 20 6c 6f 6e 67 20 2a 63 | 68 69 6c 64 73 74 61 63 | long *c|hildstac|
|00006140| 6b 3b 0d 00 00 06 00 00 | 09 00 00 16 00 01 0d 00 |k;......|........|
|00006150| 00 06 00 00 09 00 00 16 | 00 28 70 61 73 63 61 6c |........|.(pascal|
|00006160| 20 6c 6f 6e 67 20 20 20 | 20 20 41 55 58 44 69 73 | long | AUXDis|
|00006170| 70 61 74 63 68 28 73 65 | 6c 65 63 74 6f 72 2c 70 |patch(se|lector,p|
|00006180| 29 0d 00 06 00 00 09 00 | 00 16 00 1a 73 68 6f 72 |).......|....shor|
|00006190| 74 20 20 20 20 20 20 20 | 20 20 20 20 73 65 6c 65 |t | sele|
|000061a0| 63 74 6f 72 3b 0d 00 06 | 00 00 09 00 00 16 00 14 |ctor;...|........|
|000061b0| 63 68 61 72 20 20 20 20 | 20 20 20 20 20 20 20 20 |char | |
|000061c0| 2a 70 3b 0d 00 06 00 00 | 09 00 00 16 00 18 65 78 |*p;.....|......ex|
|000061d0| 74 65 72 6e 20 20 20 20 | 20 20 20 20 20 20 30 78 |tern | 0x|
|000061e0| 41 42 46 39 3b 0d 00 06 | 00 00 09 00 00 16 00 01 |ABF9;...|........|
|000061f0| 0d 20 00 06 00 00 09 00 | 00 16 00 3e 23 64 65 66 |. ......|...>#def|
|00006200| 69 6e 65 20 41 55 58 5f | 47 45 54 5f 45 4e 56 49 |ine AUX_|GET_ENVI|
|00006210| 52 4f 4e 20 31 31 20 20 | 20 20 20 20 09 2f 2a 20 |RON 11 | ./* |
|00006220| 67 65 74 20 70 6f 69 6e | 74 65 72 20 74 6f 20 65 |get poin|ter to e|
|00006230| 6e 76 69 72 6f 6e 20 2a | 2f 0d 00 06 00 00 09 00 |nviron *|/.......|
|00006240| 00 16 00 01 0d 00 00 06 | 00 00 09 00 00 16 00 13 |........|........|
|00006250| 63 68 61 72 20 2a 2a 61 | 75 78 65 6e 76 69 72 6f |char **a|uxenviro|
|00006260| 6e 3b 0d 6b 00 06 00 00 | 09 00 00 16 00 38 65 78 |n;.k....|.....8ex|
|00006270| 74 65 72 6e 20 69 6e 74 | 20 41 55 58 46 6f 72 6b |tern int| AUXFork|
|00006280| 28 29 2c 20 41 55 58 45 | 78 65 63 6c 28 29 2c 41 |(), AUXE|xecl(),A|
|00006290| 55 58 57 61 69 74 28 29 | 2c 20 41 55 58 5f 65 78 |UXWait()|, AUX_ex|
|000062a0| 69 74 28 29 3b 0d 00 06 | 00 00 09 00 00 16 00 01 |it();...|........|
|000062b0| 0d 0f 00 06 00 00 09 00 | 00 16 00 13 69 6e 74 20 |........|....int |
|000062c0| 73 79 73 74 65 6d 28 73 | 2c 66 61 6b 65 29 0d 1e |system(s|,fake)..|
|000062d0| 00 06 00 00 09 00 00 16 | 00 09 63 68 61 72 09 2a |........|..char.*|
|000062e0| 73 3b 0d 00 00 06 00 00 | 09 00 00 16 00 0b 69 6e |s;......|......in|
|000062f0| 74 20 09 66 61 6b 65 3b | 0d b4 00 06 00 00 09 00 |t .fake;|........|
|00006300| 00 16 00 02 7b 0d 00 06 | 00 00 09 00 00 16 00 15 |....{...|........|
|00006310| 09 69 6e 74 09 73 74 61 | 74 75 73 2c 20 70 69 64 |.int.sta|tus, pid|
|00006320| 2c 20 77 3b 0d 72 00 06 | 00 00 09 00 00 16 00 32 |, w;.r..|.......2|
|00006330| 09 72 65 67 69 73 74 65 | 72 20 69 6e 74 20 28 2a |.registe|r int (*|
|00006340| 69 73 74 61 74 29 28 29 | 2c 20 28 2a 71 73 74 61 |istat)()|, (*qsta|
|00006350| 74 29 28 29 2c 20 28 2a | 63 73 74 61 74 29 28 29 |t)(), (*|cstat)()|
|00006360| 3b 0d 00 06 00 00 09 00 | 00 16 00 14 09 69 6e 74 |;.......|.....int|
|00006370| 20 47 65 74 41 55 58 45 | 72 72 6e 6f 28 29 3b 0d | GetAUXE|rrno();.|
|00006380| 00 06 00 00 09 00 00 16 | 00 11 09 6c 6f 6e 67 20 |........|...long |
|00006390| 61 75 78 5f 65 72 72 6e | 6f 3b 0d ff 00 06 00 00 |aux_errn|o;......|
|000063a0| 09 00 00 16 00 02 09 0d | 00 06 00 00 09 00 00 16 |........|........|
|000063b0| 00 37 09 63 68 69 6c 64 | 73 74 61 63 6b 20 3d 20 |.7.child|stack = |
|000063c0| 28 75 6e 73 69 67 6e 65 | 64 20 6c 6f 6e 67 20 2a |(unsigne|d long *|
|000063d0| 29 20 28 4e 65 77 50 74 | 72 20 28 53 54 41 43 4b |) (NewPt|r (STACK|
|000063e0| 42 59 54 45 53 29 29 3b | 0d ff 00 06 00 00 09 00 |BYTES));|........|
|000063f0| 00 16 00 02 09 0d 00 06 | 00 00 09 00 00 16 00 1c |........|........|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.